0

I already tried to use:

white-space: nowrap
display: inline-block 

I want my div to be just as long as its content (text). The 25px padding should start directly when the text ends.

My fiddle: https://jsfiddle.net/m9uh8typ/7/

Dev Tool View

  • That might just be the dev tool being inaccurate. `white-space: nowrap;` surely isn't going to help and `display: inline-block` should work but so should `display: block`. There's nothing really wrong with your code. Besides, if it doesn't look like it's off without the dev tools, maybe it's worth just sticking with it rather than throwing overly complicated hacks at it to solve a single-pixel problem. (sidenote - zooming the window in and out shows it's just an inaccuracy in firefox's devtools. Looks fine in Chrome as well. Probably nothing to worry about) – vrugtehagel May 28 '20 at 08:29
  • But it is not a single-pixel problem, on the left side it looks like the div has padding-left: 100px and not 25 .. – Chris Goihl May 28 '20 at 08:51

0 Answers0