Home >Web Front-end >CSS Tutorial >Why does text-indent not work in css span tag?
Span tag setting text-indent does not work because text-indent can only be set for block-level elements, while span tags are inline elements; solution: use "span{display:inline-block;} " style converts span tags into inline block-level elements.
The operating environment of this tutorial: windows7 system, css3 version. This method is suitable for all brands of computers.
(Recommended tutorial: CSS Video Tutorial)
The text-indent attribute specifies the indentation of the first line of text in the text block. Note: Negative values are allowed. If the value is negative, indent the first line left.
The reason why text-indent does not work in the css span tag
And setting text-indent for span does not work because text-indent can only be used for blocks Level element settings.
Solution:
But if span{display:block}
is converted to a block-level element, it will wrap and must be floated to control, adding to the trouble.
So change the css to span{display:inline-block;}
.
For more programming-related knowledge, please visit: Introduction to Programming! !
The above is the detailed content of Why does text-indent not work in css span tag?. For more information, please follow other related articles on the PHP Chinese website!