Why does text-indent not work in css span tag?

青灯夜游
Release: 2020-12-17 18:14:40
Original
3709 people have browsed it

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.

Why does text-indent not work in css span tag?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!