Useful notes & manuals
from the
world wide web
Register now!
Empty span width and height CSS
Solution from: unknown Created by tlw on 24.05.2024 @ 04:54

If You need an empty inline span (-s) to have a width and height (for background image or something else) then there is a fix for that.

Span is an inline element so it has to be filled with content and ignores the width and height but not padding, so here is the trick: {
padding: 10px 20px; // height=20px, width=40px
font-size: 0px;

The font-size is used to fix the height's value of the span

css   span   empty   block   inline   inner
Created by THE LOST WEB © 2009-2012