Showing posts with label snipplr. Show all posts
Showing posts with label snipplr. Show all posts

Monday, 25 October 2010

Centre a DIV, interpret font sizes and snipplr

I have been subscribed to recently. It's very good. It's a sort of social networking site for coders. Below are a couple examples of things I got from the site this morning contained in the same page. The first technique is how to centre a DIV inside another DIV. Very useful.
The second technique is to set the font size within the body CSS body reference to 62.5%. The result is that when you apply font-size:1em later, this translates to 10px. font-size1.2em is equal to 12px etc. Very useful too.

See demo.

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Centre a DIV inside a DIV</title>
<style type="text/css">
margin:0 auto;
<div id="outer">
<div id="inner"><p>Hello World!</p></div>