Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-06-03 07:51:33 10月01日 Update

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.

Tags: Font function browser browse purpose size percentage percentage negative value code even content unit object skill number knowledge length conciseness nuance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Xiaomi NVidia Redmi MariaDB