Jump to content

cannot float element right


jimfog
 Share

Recommended Posts

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...