Jump to content

Centering Text within a floated <div>


Guest orthodoxkohen

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...