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:
<div>
Content goes here
</div>
You can also add some style to it by doing the following:
<div id=”container”>
Content goes here
</div>
Then in the CSS file, we will have the following:
#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 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,
<p> This is an <span class=”orangeboldtext”>example</span>.</p>
Then in the CSS file,
.orangeboldtext {
font-size: small;
color: #FF5A00;
font-weight: bold;
}