Jump to content

Centering Text within a floated <div>


Guest orthodoxkohen
 Share

Recommended Posts

Guest orthodoxkohen

I hope there's a solution to mixing fluid widths and containers. I've tried centering a text within a left or right floated div to no avail. Please let me know of your methods.

Link to comment
Share on other sites

Floating elements is originally meant for positioning images inside paragraphs as to let the text wrap around it, not for horizontal aligning block elements.Notice that float will work in IE, but using other browsers you'll get unexpected problems. That Internet Explorer allows elements to be floated left or right of other elements by using float, does not mean it is correctly interpreting that property. In other browsers it will actually result in the floated element taking part of the width of its parent, not apearing next to but inside it :)Having said that, centering text in a floated element could result in something completely different to what you originally meant, because of this special definition of a "floated element" :)

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...