Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use css to indent the first line by 2 characters

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to use css for the first line indentation of 2 characters", in daily operation, I believe many people in how to use css for the first line indentation of 2 characters on the question there are doubts, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "how to use css for the first line indentation of 2 characters" doubts helpful! Next, please follow the small series to learn together!

css Set the first line indent 2 characters: You can use the text-indent attribute to set the first line indent 2 characters, such as [text-indent:2em;]. The text-index attribute is used to specify the indentation of the first line of text in a text block, em being the relative unit.

Related Attributes:

The text-indent attribute specifies the indentation of the first line of text in the text block.

(Recommended video tutorial: CSS video tutorial)

Attribute Value:

length defines a fixed indentation. Default: 0.

% Defines indentation based on percentage of parent element width.

inherit specifies that the value of the text-indent attribute should be inherited from the parent element.

Implementation code:

first line indent

.demo{

width: 550px;

height: 200px;

margin: 50px auto;

}

p{

text-indent:2em;/*em is a relative unit, 2em is twice the size of a word */

}

}

This is a test code, is a paragraph of text about css indentation. This is a test code, is a paragraph of text about css indentation.

This is a test code, is a paragraph of text about css indentation. This is a test code, is a paragraph of text about css indentation.

This is a test code, is a paragraph of text about css indentation. This is a test code, is a paragraph of text about css indentation.

At this point, about "how to use css for the first line indentation 2 characters" learning is over, I hope to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report