Skip to content

Instantly share code, notes, and snippets.

@jensgro
Last active October 3, 2015 07:48
Show Gist options
  • Save jensgro/2420037 to your computer and use it in GitHub Desktop.
Save jensgro/2420037 to your computer and use it in GitHub Desktop.
Untitled
padding: 5px;body {
font-family: sans-serif;
}
ul {
list-style: none
}
li {
background: slategrey;
display: inline-block;
color: #fff;
padding: 5px;
/* inline block hack for IE 6&7 */
zoom: 1;
*display: inline;
}
ul.white-space-fix li {
margin-right: -5px;
}
<h1>Inline-block / white-space bug</h1>
original...
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
fixed by funky code formatting...
<ul>
<li>
one</li><li>
two</li><li>
three</li>
</ul>
fixed by adding html comments...
<ul>
<li>one</li><!--
--><li>two</li><!--
--><li>three</li>
</ul>
fixed by CSS margin-right: -5px; (breaks in IE6&7)...
<ul class="white-space-fix">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
<strong>for simplicity i prefer to fix by omitting the &lt;/li&gt;...</strong>
<ul>
<li>one
<li>two
<li>three
</ul>
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment