<!-- CSS:Basics snippet 10. -->
<!-- The division element generic container box. -->
<!-- Add borders, margins and padding. -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Code source: http://www.justfigures.co.uk/ -->
<!-- A resource for web developers using XHTML, CSS, JavaScript, PHP -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>View snippet page</title>
<style type="text/css">
p {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: #000000;
}
/* division element box with individual borders */
#myBox1 {
border-top:2px solid #6699FF;
border-right:5px solid #6699FF;
border-bottom:2px solid #6699FF;
border-left:5px solid #6699FF;
}
/* division element box with border and margins */
#myBox2 {
/* borders set for all sides equal */
border:2px solid #000000;
/* margins set for top, right, bottom, left respectively */
margin:20px 50px 20px 50px;
background-color: #3399FF;
}
/* division element box with border and padding */
#myBox3 {
/* borders set for all sides equal */
border:2px solid #000000;
/* padding set for all sides equal */
padding:20px;
background-color: #3399FF;
}
</style>
</head>
<body>
<div id="myBox1">
<p>A division element box containing text and displaying borders.</p>
<p>A division element will display as a block element.</p>
</div>
<div id="myBox2">
<p>A division element with margins, borders and background.</p>
</div>
<div id="myBox3">
<p>A division element with padding, borders and background.</p>
</div>
</body>
</html>