HTML and CSS Reference
In-Depth Information
margin-bottom to 10px, then you are extending the height of the element by 10 pixels. These 10 extra
pixels of height are rendered with a transparent background though.
Defining width and height
By default, HTML elements take up just the minimum space they need to render their content.
In some cases, you might want to assign them a fixed size, whether absolute or relative. The
properties you need to do this are width and height . You typically set width and height using pixels or
percentages.
body {
width: 100%;
}
Here's a more interesting example of CSS settings that produce a layout like the one shown in
Figure 3-8. First start from the HTML:
<body>
<header>
Header of the page
</header>
<div id="main">
main
</div>
</body>
And here's the related CSS content:
body {
margin: 0px;
}
header {
width: 100%;
height: 80px;
}
#main {
width: 930px;
height: 100%;
margin: 0px;
margin-left: auto;
}
Search WWH ::




Custom Search