Why does <span> violate <div> when margin and addition are applied?
I know this is very simple CSS. How to save the range contained in a div? Currently, the span extends beyond the top and bottom of the div.
String elements will not use vertical padding and space with an edge. You can do a span display: block , but without any details, I donβt know if this will achieve your goal.
The vertical padding, border, and edge of an embedded, non-replaced block (such as span) begin at the top and bottom of the content area and have nothing to do with the "line height". But when calculating the line height of a line, only line-height is used. So you see the overlap here: http://jsfiddle.net/Q9AED/
If you want to use a simple solution, you can use linear height, not display: inline-block: using line height .
display: the built-in block works in Safari> = 2, Opera> = 9, IE> = 8, Firefox> 3. But you can simulate the built-in block in IE <8: display: built-in; zoom: 1.