Skip to content

Instantly share code, notes, and snippets.

@sagiavinash
Created April 28, 2015 17:18
Show Gist options
  • Save sagiavinash/4b9e7fa139eaee2e736f to your computer and use it in GitHub Desktop.
Save sagiavinash/4b9e7fa139eaee2e736f to your computer and use it in GitHub Desktop.
fix to remove space between inline-block elements due to line-breaks in code
/* Solution 0:
* Avoiding line breaks in code or using multi-line comments as placeholders for line-breaks.
* Its best to adopt this solution if its part of the html build process to remove whitespaces.
*/
/* Solution 1:
* use width=device-width (needed for iphone).
*/
.list-wrapper {
letter-spacing: -0.31em; /* -4px doesnt work in zoomed states */
}
.list-wrapper .list-item {
letter-spacing: normal;
}
/* Solution 2:
* Pre-Jellybean does not remove the space at all, and Jellybean has a bug whereby the last element randomly has a tiny bit of space.
* This doesnt work when child element font-size declaration is in em. it should be rem or px.
*/
.list-wrapper{
font-size:0;
}
.list-wrapper .list-item{
display: inline-block;
font-size:16px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment