View Full Version : Aligning Left/Center/Right on Same Line?
xoblivionxfantasyx
04-29-2007, 04:28 PM
Is it possible to have text aligned to the left, center, and right all on the same line without any line breaks? I have used the <div style="float:left"> or <div style="float:right"> to align text on the left side and the right side with out any line breaks, but how can i get text to be in the middle of those two without line breaking?
~Thanks
Yes, but you need three different block-level elements:
<p style="float: left; width: 32%; text-align: left;">Left text</p>
<p style="float: left; width: 32%; text-align: center;">Centre text</p>
<p style="float: left; width: 32%; text-align: right;">Right text</p>Note that I left 4% free for margins, borders and the like. That may differ for you depending on the rest of your stylesheet.
xoblivionxfantasyx
04-29-2007, 05:27 PM
After the left text the line breaks but the center and right text are one the same line how can i have it so that all the text is on the same line and no breaks?
Hence my comment:
Note that I left 4% free for margins, borders and the like. That may differ for you depending on the rest of your stylesheet.I suspect you've something else on the page that takes up >4% of the width. Lower the numbers, or use percentages to specify the width of that as well.
xoblivionxfantasyx
04-29-2007, 05:39 PM
I am using a blank page to test the code so there is nothing else there and no matter what the percentage is the after the left text there is a break
Hmm... where is this page?
xoblivionxfantasyx
04-29-2007, 05:49 PM
http://www.geocities.com/romanianworld7/alignmenttest.html
Looks fine here in Konqueror and Firefox.
xoblivionxfantasyx
04-29-2007, 06:05 PM
hmm that's strange then, i am using firefox and it appears to have a line break after the left text
Hm, I see it in Firefox 2 but not a3 or Konqueror. Possibly a Fx2 bug?
xoblivionxfantasyx
04-30-2007, 12:50 AM
Maybe, because it displays fine in IE
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.