Forum Moderators: not2easy
I'm trying to make two DIV's float, one right and one left but on the same line. This is for a ontent box but i do not want to use tables but the eqivent would be ..
____________________
¦Header ¦ SubH ¦
¦--------------------¦
¦ Paragraph content ¦
¦ here ¦
¦____________________¦
Sorry for the poor ascii art ;)
I have tried floating two divs left but the text remain aligned left despite asking for text-align:right; in the sub header div.
Any help appreciated ;)
Mike
<body>
<div id="div1">something</div>
<div id="div2">something</div>
</body>
To place them next to each other you'll need to apply the following styles to them:
#div1 {
float: left;
width: 50%;
}
#div2 {
float:left; /* or float:right; */
width: 50%;
}
That's it. Have in mind that if you apply any paddings or margins or borders to them - their width will be counted in, so you will need to set a smaller overall width value.
Hope that helps,
-=ms=-