CSS Divisions
divisions Divisions are a block level HTML element used to define sections of an HTML file. You define a division within an HTML file by placing the following between the <body></body> tags:
<div>
Site contents go here
</div>
With id:
<div id="container">
Site contents go here
</div>
CSSfile: #container{ width: 300px; margin: auto; border: 1px solid #666; background: #ffffff; }
div { display: inline; /* Default, unless UA stylesheet overrides */ display: inline-block;/* Characteristics of block, but sits on a line */ display: block; /* UA stylesheet makes things like div and section block */ display: run-in; /* Not particularly well supported or common */ display: none; /* Hide */ }
div.x1 { width:500px; margin: auto; border: 3px solid #15ff44; } div.x2 { max-width:300px; margin: auto; border: 3px solid #15ff44; }
This div element has width: 500px;

This div element has max-width: 500px;



CSS div style
<div style="width:50%;border:2px solid gray;
padding:8px;background:#f1efbb "> <p style="margin-right:150px;">
CSS div style</p>