width - Why does inline-block element expand more than its content? -


take here: http://dabblet.com/gist/8d85e0e30b4d46e14654.

why span element expand if 2 words on same line?
there way prevent , have wrap minimum width possible given content size?

edit:
using 'white-space:nowrap;` doesn't fix issue.
i'm trying make span fit text, not text fit span.
that's why parent div has fixed width.

here's screenshot.
enter image description here

thank you.

try this: link

span {     display:inline-block;     background:#333333;     color:#ffffff;     white-space: nowrap;     overflow: hidden;     } div {     width:80px; } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -