1

justified text

The top shows Firefox/IE. The bottom is Google Chrome. Notice the tiny space on the right?

<ul>
    <li><a href="#">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Item 3</a></li>
</ul>

ul {
    padding: 0;
    margin: 0;
    width: 300px; 
    list-style-type: none;
    text-align: justify;
    background-color: #00f;
}

ul:after {
    content: '';
    display: inline-block;
    width: 100%;
}

li {
    display: inline-block;
}

a {
    color: #fff;
}

http://jsfiddle.net/EtU9j/

Where is that tiny space coming from? Why doesn't it justify flush to the edge?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Sunny
  • 2,232
  • 7
  • 24
  • 36
  • Doesn't happen on my Chrome 29.0.1547.66 – Itay Sep 05 '13 at 13:54
  • I had something like this a while ago, near the end of this answer: http://stackoverflow.com/questions/6865194/fluid-width-with-equally-spaced-divs/6880421#6880421 – thirtydot Sep 05 '13 at 14:01

1 Answers1

5

It´s the whitespace between the last </li> and </ul>. It´s approximately 4px wide with normal fontsize.

this:

<ul>
    <li><a href="#">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Item 3</a></li></ul>

or this:

<ul>
    <li><a href="#">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Item 3</a></li><!--
--></ul>

will fix it.

anddoutoi
  • 9,973
  • 4
  • 29
  • 28