Forum Moderators: not2easy
<style type="text/css">
div.1 {float: left;}
div.2 {float: right;}
div.3 {float: right;}
</style>
<div class="1"> </div>
<div class="2"> </div>
But then I added a third div, like this:
<div class="1"> </div>
<div class="2"> </div>
<div class="3"> </div>
I thought div 3 would be floated all the way to the right, with div 2 going between divs 1 and 3. Instead, to achieve that effect, I had to put div 3 in the middle of the code. Only then would it display at the right on the page.
What's the deal with floating page elements? How should it best be used?
That's if #3 can fit between #1 and #2. If not, #3 will float to the right side underneath #2.
Unless #2 is really long and #1 is really short then #3 floats beneath #1 against #2. It gets hard to explain without a picture.
<style type="text/css">
div.1 {float: left;}
div.2 {float: left;}
div.3 {float: right;}
</style>
or this:
<style type="text/css">
div.1 {float: left;}
div.2 {float: right;}
div.3 {float: right;}
</style>
<div class="1"> </div>
<div class="2">
<div class="3"> </div>
</div>