How to align two div
This example explains how to perform the alignment of two text fields.
With this example we would show how to perform the alignment of two boxes (in this case we use two div tags). "Alignment" means placing the two boxes horizontally next to each other. They will have the same height.
CSS
div#container {
width: 90%;
border: 1px solid #000;
text-align: center;
}
div.split2 div {
float: left;
width: 50%;
}
div.wide {
clear: left;
}
HTML Code
<div id="container">
<div class="split2">
<div>
<h1>Column title no. 1</h1>
<p>The content of the first column.</p>
</div>
<div>
<h1>Column title no. 2</h1>
<p>The content of the second column.</p>
</div>
</div>
<div class="wide"><p>This div has a clear set to prevent the float of the two columns of text.<br />
<a href="http://www.icelab.eu/en/blog/css-4/how-to-align-two-div-4.htm">View full example</a></p></div>
</div>Notes
html, css, graphic, webdesign, align div, horizontal div alignment, parallel box
Publication details
Category: CSS
Published by: loryzz on date: 29.02.2008 23:14:24
Last edit by: loryzz on date: 24.06.2009 17:58:41
Ratings
Leave a comment
All comments must be approved by site administrator.
Please write comments on topic. Spam will be never approved.
CSS: Linked articles
XHTML and CSS strike alternatives published by loryzz in CSS
Testo lampeggiante published by loryzz in CSS
Table style with css published by loryzz in CSS
Min-width property published by loryzz in CSS
Min-height property published by loryzz in CSS
























Ritorna all'inizio
Based total comments
0 %
Comments percentage
0 %