0

Is it possible to calculate the width in pixel of white space given certain font-size and font-family?

For example, if I plan to use negative margin-left to offset the white space between inline-blocks, I need to know the width of white space.

ul > li{
   display:inline-block;
   margin-left:-???px;/*calculate this one*/
}
J.Joe
  • 644
  • 2
  • 7
  • 20
  • I wouldn't recommend using the margin-left technique there a better methods but [**in general**](http://stackoverflow.com/a/19038875/2802040) it's `.25em` which at 16px is 4px. I'd use `em' for preference then you don't have to change it. – Paulie_D Jul 13 '16 at 18:37
  • http://stackoverflow.com/questions/5078239/how-to-remove-the-space-between-inline-block-elements – Paulie_D Jul 13 '16 at 18:38
  • 1
    @Paulie_D `This usually equates to .25em (or 4px)` Where did you get this one? Any reference? – J.Joe Jul 13 '16 at 18:54
  • Nope...it just is...is the size of a "space" apparently. However, the *negative margin* solution is considered to be the [**worst**](https://davidwalsh.name/remove-whitespace-inline-block) solution of them all...expecially nowadays. – Paulie_D Jul 13 '16 at 18:58

0 Answers0