jimfog Posted March 31, 2011 Share Posted March 31, 2011 As the title suggests i cannot float an element to the right.More specifically:Inside an element(parent) i have 2 elements, one is floated left(nothing wrong with this) and another one i am trying to float right without success.What happens is that the element that i want to float right appears BELOW the left floated element. I have tried various combinations with the clear property without a desired result.Another thing is that if i do not apply the float right property in the element in question, than, the element appears where i want it, in the right side of the left floated element-nonetheless(because this element contains a text of block) with float right i wish the text to be aligned right. Nevertheless, out of curiosity, (and for reasons of right text element)i still want to learn why the float right property does not work.Here is the code:#all is the parent element#leftcolumn, is the element which successfully is floated rightand#centralcolumn is the element in which i cannot apply the float property. #all {height:auto;margin-left:auto;margin-right:auto;border:#009 thick solid;width:800px;}#leftcolumn { float:left;}#centralcolumn { float:right; } Thanks, i hope i was not confusing. Link to comment Share on other sites More sharing options...
ShadowMage Posted March 31, 2011 Share Posted March 31, 2011 What does your HTML look like? Order is important when you're floating elements. Link to comment Share on other sites More sharing options...
jeffman Posted March 31, 2011 Share Posted March 31, 2011 There must be more to this than meets the eye. It sounds like the total widths of the column elements may add up to something larger than #all. The resulting bevhaior would be different depending on whether the columns are block-level or inline elements. You can learn a lot by giving your elements temporary background colors (they should be different). Link to comment Share on other sites More sharing options...
jimfog Posted April 4, 2011 Author Share Posted April 4, 2011 There must be more to this than meets the eye. It sounds like the total widths of the column elements may add up to something larger than #all. The resulting bevhaior would be different depending on whether the columns are block-level or inline elements. You can learn a lot by giving your elements temporary background colors (they should be different).You were right, the total width of the columns exceeded the width of the #all element.I reduced the with of the central column and the problem was fixed.Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.