The reason why the indentation of the first line of css has no effect and the solution: 1. The element is not a block-level element. The solution is to use "display:inline-block;" to make the label have the attributes of some block-level elements; 2. The effect is overridden by a style with a higher priority. The solution is to modify the priority.
The operating environment of this tutorial: Windows 7 system, css3 version. This method is suitable for all brands of computers.
Recommended: "css Video Tutorial"
In web page layout, the first line indentation is a very common effect. It makes your paragraphs look more standardized and tidy! Sometimes the first line indentation is set through CSS, but it has no effect. What is the reason?
The first line indentation in css uses the text-indent attribute, and its value allows the use of numbers, percentages, and inherit.
The reason why the indentation of the first line of css is invalid:
The element is not a block-level element
The effect has a higher priority The styles are covered.
Solution:
1. Determine whether the label is a block-level element. If not, you can use display:inline-block; to make it have the attributes of some block-level elements.
2. Check whether it is an invalid problem caused by !important priority!important > id > class > tag
Usage example:
p{ text-indent: 2em; }
Indent two The width of Chinese characters text-indent:2em;
(The unit em means the relative text size, 1em is the size of one text, and 2em is the size of two texts)
The above is the detailed content of Why does the indentation of the first line of css have no effect?. For more information, please follow other related articles on the PHP Chinese website!