views:

38

answers:

2

Why my text has the justify effect? In my whole site, I make echos and i dont specify a "text-align:justify;" but my text is still justifying. Justify is when you make the browser window smaller, the text moves so it fits in the window. I tryed making something like this: <?php echo "<h1>some stuff.</h1>"; ?> <html> <head> <style> h1 { text-align:center; } etc....

but it just makes the text go in the center and it keeps the justify effect.

please help me =[ thanks

+2  A: 

Justify is when you make the browser window smaller, the text moves so it fits in the window.

That's not what justify is. Justify makes it so all lines of text are the same width, like this:

alt text

If you don't want the text to stay inside the window when you shrink it (so if you want a horizontal scrollbar), you have to set a min-width on a <div> containing the text.

Edit: though maybe I misunderstood what you were actually trying to do, and you just want it centered. If so, use margin: 0 auto; not text-align: center;

Chad Birch
woaw the min-widht did the thing :) thank you, but i still don't understand why it was not messed up like this? Why with other sites it didn't did that...
linkcool
A: 

Justifying is when the spacing between the words is adjusted so text is fully aligned on both the left and the right of the block of text.

What you are describing sounds like even though you want the text centered, it is long enough to fill the page and thus doesn't really look centered. Consider adding something like this. The fixed width keeps the text from filling the window, and the margin: 0 auto centers the h1 tag itself:

<style type="text/css">
    h1 { text-align: center; width: 300px; margin: 0 auto }
</style>
Doug Neiner
yeah well i just needed the min-width:5000px; because if i remove it, the text would resize when i resize the window.
linkcool