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 indent 2 characters in the first line of css

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

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces css how to achieve the first line indentation 2 characters, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

1. First apply the indented CSS attribute: text-indent

2. Accurate selection of units:

1), px unit

If you know the font size and it is fixed, you can use px as the indent value unit.

If the font size is 12px, set text-indent:24px (around 24px).

2), em unit (highly recommended)

Em is a unit of relative length

No matter how much the font size is set, the em unit is used as the indent style unit, and the text length can be indented adaptively.

Text-indent:2em set 2em, you can achieve no matter how much the font size, can adaptively indent 2 words distance space effect.

3. Indent the position of 2 Chinese characters

Just indented a 2-word CSS instance

.f14 {font-size:14px}

.f22 {font-size:22px}

.sjlz {text-indent:2em}

My font size is 14px to see if it happens to indent 2 Chinese characters.

My font size is 2px to see if it happens to indent 2 Chinese characters.

Thank you for reading this article carefully. I hope the article "how to indent 2 characters in the first line of css" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Development

Wechat

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

12
Report