Create a Website
HTML
Dreamweaver
CSS Tutorial
JavaScript
FREE Hosting!
With every domain name
you register at DotEasy
you get FREE (no-ad)
one year hosting.
PLUS you get:
  • FREE Website Builder
  • FREE Blog
  • FREE Forum
  • FREE Photo Album
  • FREE Email Accounts
Get your FREE hosting today!
Home > JavaScript Tutorial
$0 Web Hosting

Divisions

Divisions are used to define sections of an (X)HTML file. A division can contain all the parts that make up your website. You can define a division within an (X)HTML file by placing the following between the <body></body> tags:

The Code

<div>
Content goes here
</div>

You can also add some style to it by doing the following:

The Code

<div id=”container”>
Content goes here
</div>

Then in the CSS file, we will have the following:

The Code

#container {
width: 80%;
margin: auto;
padding: 20px;
border: 1px solid #666;
background: #FFFFFF;
}

Everything within the “container” division will be styled by that division style rule defined n the CSS file. A division creates a linebreak by default.

Spans

Spans are very similar to divisions except they are an inline element versus a block level element. No linebreak is created when a span is declared.

Span tags are often used to style certain areas of text,

The Code

<p> This is an <span class=”orangeboldtext”>example</span>.</p>

Then in the CSS file,

The Code

.orangeboldtext {
font-size: small;
color: #FF5A00;
font-weight: bold;
}

Enjoy this tutorial?

1. Link to this page(copy/paste into your own website or blog):
2. Add this page to your favorite social bookmarks sites:
3. Add this page as your favorites. (Press Ctrl+D)