
Originally Posted by
misheck
I need to to format or d...
...eference them after body tag?
Hi mishec,
As a quick example (because example is a better tool to learn from than theory, imo) I will show you the structure I would use below:
The HTML:
Be sure to add your DOC type etc. I normally use XHTML 1.0 Strict and there maybe issues using my code below in anything other than this.
HTML Code:
<body>
<div id="wrapper">
<div id="largecolumn">
<h2>Title</h2>
<p>The small red fox jumped over the lazy brown dog.</p>
</div>
<div id="smallcolumn">
<h2>Title</h2>
<p>The small red fox jumped over the lazy brown dog.</p>
</div>
<div id="mediumcolumn">
<h2>Title</h2>
<p>The small red fox jumped over the lazy brown dog.</p>
</div>
<p class="clear"></p>
</div>
</body> So what we have here is:
ID: Wrapper, this is used to contain your columns.
ID's: large, medium, small - The columns.
Class: Clear, This is used to stop anything below, i.e. footer etc, from bumping up into your columns or floating underneath a short colum when you dont want it to.
The basic CSS is as follows:
Code:
/* Reset your elements */
div, h2, p { margin:0; padding:0; }
/* Classes */
.clear { clear:both; }
/* ID's */
#wrapper, #largecolumn, #mediumcolumn, #smallcolumn { float:left; }
#wrapper {
width: 96%;
padding: 0 2%;
}
#largecolumn {
width: 40%;
margin: 0 1%;
}
#mediumcolumn {
width: 30%;
margin: 0 1%;
}
#smallcolumn {
width: 20%;
margin: 0 1%;
}
#wrapper div h2 {
margin: 5px 5%;
}
#wrapper div p {
margin: 3px 5%;
} This will produce your 3 columns and it gives a small gutter between each one, I have also popped a little spacing around the header and paragraph.
Most importantly, experiment. Deleting a line or style may mess up the page but you can always change it back, the best way to learn is to experiment and learn from your achivements, mistakes and failures/sucesses.
I hope this post has given you atleast a little insight.
Bookmarks