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

What is the purpose and function of font-size:100%?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article shows you what the purpose and function of font-size:100% are, the content is concise and easy to understand, and can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The code is as follows:

H2,h3,h4,h5,h6,h7 {font-size:100%;font-weight:normal;}

Input,select,textarea,samp {font-size:100%;}

Seeing some css resets, what is the purpose and purpose of setting font-size:100%?

-

If you set body {font-size:12px;}

But H2 will not inherit this 12px, it will increase the font size by a certain percentage, but if you specify font- for the H2 test

Size:100%; it inherits the font size set by body.

1. It changes the default size.

two。 These elements themselves do not inherit the font size of the parent, but can be inherited automatically when font-size:100% is set.

Line-height: normal | length

Parameters:

Normal: default line height

Length: percentage number | length value consisting of floating point numbers and unit identifiers, which is allowed to be negative. The percentage value is based on the height size of the font. See length unit

Description

Retrieves or sets the row height of the object. That is, the distance between the bottom of the font and the inner top of the font.

If the row contains multiple objects, the maximum row height is applied. The row height cannot be negative at this time.

The corresponding script feature is lineHeight. Please refer to other bibliographies I have written.

Example

The code is as follows:

Div {line-height:6px;}

Div {line-height:10.5;}

Be careful

1. Using line-height only works on text and fails when it comes to pictures

two。 You can see the effect of instant line-height with dreamweaver.

3. Negative values can be used when using line-height

It should be noted that there are slight differences in the solution of line-height among browsers, and there will be differences in 1px up and down. If the row height is even, the interpretation of most browsers is relatively normal. If it is an odd number, some browsers will have more 1px than the next, while others will have more 1px than the top. For some websites with more stringent requirements, it is recommended to use even numbers when designing the row height.

The above content is what is the purpose and function of font-size:100%, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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