1

I am currently having an issue when a table cell contains no content, the formatting is thrown off and despite trying various techniques am unable to get it to display inline in the same way as ones with content do.

    <ul class="uk-wizard-progress">
        <li class="uk-complete">Welcome</li>
        <li class="uk-active"></li>
        <li>Source</li>
    </ul>

Example: http://codepen.io/nblackburn/pen/MKRVXa

I need to support both populated and unpopulated table cells but would like to tackle this with only CSS if it is at all possible.

Thanks in advance.

nblackburn
  • 268
  • 2
  • 14

2 Answers2

0
li::after { content:"\00a0"; }
Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
  • 1
    This will not work. You're using wrong unicode. In CSS you must use escaped unicode. – Viktor Feb 18 '16 at 20:16
  • 1
    Thanks. I still think you should make that ::after instead of adding it to the ::before so li's with content don't lead off with a space. – Scott Marcus Feb 18 '16 at 20:18
0

Just change your content in li:before to '\00a0' like so:

li:before {
  height: 10px;
  display: block;
  margin-top: 5px;
  content: '\00a0';
  background: #dddddd;
  margin-bottom: 10px;
  transition: all 0.3s ease-in-out;
}

Or add content: '\0020' to li:after as Scott Marcus suggested. This will prevent an appearance of extra space before your table cell content:

li:after {
 content: '\0020';
 /* ... */
}

This is actually a best practice.


Source: Add a space (" ") after an element using :after

Community
  • 1
  • 1
Viktor
  • 4,218
  • 4
  • 32
  • 63