Thomas Wallace: Lectures and Resources - A collection of website design lectures and resources

Creating Code Blocks

At this point we are ready to begin laying the groundwork for our new web site. The first step in the physical creation of the site, is to create blocks of code that we can reference externally via style sheets. To create these blocks we surround the content with a <div> tag

Example:

<div>Your Content Goes Here.</div> 

While this gives us a way to create code blocks, there is still no way to address a specific block unless we give it a name. To give a <div> tag a name, also known as the ID attribute, we would write is like this.

<div id="mydivname"> Your Content Goes Here.</div> 


Code blocks can also be nested inside one another which provides additional flexiblity and control when styling our document.

Code Blocks for Your Website

<div id="container">
   <div id="header">Site Header (h1)</div>
   <div id="content">Sample Content</div>
   <div id="navigation">Navigation</div>
   <div id="footer">Footer Info (h6)</div>
 </div> 


 


What I'm Reading

RSS Feed IconView More

Announcements

  • 1.24.2012
    Structure, Content, Design, Behavior
My Calendar