PDA

View Full Version : CSS positioning


arag0rn
05-24-2006, 10:06 AM
What is the best way to put three things side by side (like from left to right)?

I can think of the following things.

1) Since, the float works for only left and right, i will make a div container containing all three of them and a div container containing two adjacent ones and then use float to place them.

2) Is using absolute positioning advisable? I mean i can specify put Thing1 at top left. Thing 2 at 100 px from left. etc

If there are better methods, please suggest them.

<h1>
05-24-2006, 10:55 AM
To put three 3 divs side-by-side, I would use float:left for all 3 divs

<style type="text/css">
. float {width:100px;float:left}
</style>

<div class="float">Container 1</div>
<div class="float">Container 2</div>
<div class="float">Container 3</div>