September 2, 200818 yr Hello! Ive looked through the forum and ive looked at probably 50 different tutorials about css/html but none of them really explains about div. Im after a tutorial that explains DIV from the bottom! Most tutorials mention DIV but only short and they do go through it at all. So if you know any please tell me Regards Hansen
September 2, 200818 yr A HTML DIV tag is for dividing parts of a document into DIVisions. An example page might have three divisions Header Content Footer and translated into HTML would look like this... <div> <h1>My heading</h1> </div> <div> <p>My content</p> </div> <div> <p>My footer</p> </div> But, that code doesn't have the DIV tags doing anything useful so we add a CSS class to each... <div class="header"> <h1>My heading</h1> </div> <div class="content"> <p>My content</p> </div> <div class="footer"> <p>My footer</p> </div> Now you can use CSS to style each DIV independantly, colours, borders, backgrounds, padding, margin, width, alignment etc. And that really is DIV in a nutshell, there's not much more to it than that.
September 3, 200818 yr To add to Blue's comment, and not wishing to confuse further, you could also use an ID for the DIV (and probably should). This indicates that that section of code is unique within the web page and allows you greater scope for styling. Just substitute the CLASS for an ID. For reference the CLASS tag should be used where the same style need to be applied to several elements on the page (eg: a photo portfolio where each photo has the same styling). My two-penneth.
September 3, 200818 yr As it happens I'm writing a tutorial on CSS layout at the minute, which covers DIVs in depth, like my other CSS tutorial (see my sig) it is aimed at absolute beginners.
October 14, 200817 yr Here's a website walkthrough I made - look at the Source of each page as you see it. Div's are basically just boxes. http://www.brett-munro.com/MakeThisWebsite
Create an account or sign in to comment