adamcannon Posted May 11, 2007 Share Posted May 11, 2007 I have three tables that are positioned (relative) 25px from each other. The code below works fine for this purpose but I'm not sure why. Precisely, why is div.right set to 50px instead of 25px? div.left { clear:left; float:left; } div.center { float:left; position:relative; left:25px; } div.right { float:left; position:relative; left:50px; } Quote Link to comment https://forums.phpfreaks.com/topic/50891-why-does-this-css-code-work/ Share on other sites More sharing options...
cmgmyr Posted May 17, 2007 Share Posted May 17, 2007 "left" is from the left of the page...not from the element next to it. if you wanted to do it another way you could use margin or padding and that would be from the element next to it Quote Link to comment https://forums.phpfreaks.com/topic/50891-why-does-this-css-code-work/#findComment-255041 Share on other sites More sharing options...
dbrimlow Posted May 19, 2007 Share Posted May 19, 2007 You can also remove the "position:relative" elements and that first "clear:left". If you are placing these divs in order, then they are already "relative". The clear:left is then negated by the next command of float:left. That's as if I used, .widths { width:300px; width:500px } The last command always replaces the previous. Quote Link to comment https://forums.phpfreaks.com/topic/50891-why-does-this-css-code-work/#findComment-257075 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.