htmlcsshtml-tableinternet-explorer-7line-breaks

HTML Tables - How to make IE not break lines at hyphens


I have some table cells containing dates formatted like this: 2009-01-01. I.E 7 seems to be breaking these into two lines at the hyphen. Is there any way to turn this off?


Solution

  • You are looking for the white-space property, which affords you control over how white space and line-breaks affect the content of your element. To collapse white space sequences, but prevent line-breaks, you can use the nowrap value:

    .dates {
        white-space: nowrap;
    }
    
    <td class="dates">2009-01-01</td>