Home Web Front-end CSS Tutorial Css line-height calculation

Css line-height calculation

Feb 09, 2017 pm 04:47 PM
css

line-height represents the line height, that is, the distance between the baselines of two lines of text.

Line box box -> Inline box (inline element) -> Anonymous inline box (content area/text/inline box), contained in sequence, one line box per line, multiple lines multiple lines Line boxes accumulate.

Css line-height calculation

Line spacing is the distance between two lines of text, from the bottom line of the first line of text to the top line of the second line of text.

Half line spacing is half of the line spacing.

Line height = content area + line spacing, (under some fonts, the height of the content area is equal to the font size, such as SimSun Song Dynasty)

Css line-height calculation

1. There is no relationship between the height of block-level elements and the font size. They are supported by the line height

Css line-height calculation

Css line-height calculation

Css line-height calculation

##2. The height of the inline element is expanded by the font size. The set line height does not affect the element height

Css line-height calculation

Css line-height calculation

Css line-height calculation

Css line-height calculation

#Three and two lines of text, set the line height, The smaller the value, the smaller the line spacing will be because the size of the content area remains unchanged, and overlap will occur. The minimum line height is 0. Vice versa.

Css line-height calculation

Css line-height calculation

Four, In a block-level container, the principle of vertically centering an inline element (it just looks centered, not actually centered) is:

When setting the row height, the height of the content area remains unchanged ( Generally determined by font-size and font-family), the half-line spacing increases/decreases (negative half-line spacing) to the upper and lower sides of the content area respectively

Css line-height calculationCss line-height calculation##                                                                                                                                                                                                                                      

##For more articles related to line-height calculation of Css, please pay attention to the PHP Chinese website! Css line-height calculationCss line-height calculation

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use CSS to efficiently achieve various concave effects? How to use CSS to efficiently achieve various concave effects? Apr 05, 2025 pm 02:18 PM

Many ways to achieve concave effects in CSS Many developers have encountered the need to achieve concave effects in web pages. Recently, a developer mentioned on the forum...

How to properly introduce index.css file of Element UI and avoid style loading failures? How to properly introduce index.css file of Element UI and avoid style loading failures? Apr 05, 2025 pm 02:33 PM

Best practices about the introduction of ElementUI style files Many developers are using Element...

How to solve the problem of page scrolling after the soft keyboard of the mobile Edge browser pops up? How to solve the problem of page scrolling after the soft keyboard of the mobile Edge browser pops up? Apr 05, 2025 pm 02:57 PM

Regarding the Edge browser input method, page height and scrolling after the keyboard pops up. When using the Edge browser on your mobile phone, the page often encounters this problem: �...

How to add loading animation to the a tag click and then jump? How to add loading animation to the a tag click and then jump? Apr 05, 2025 pm 04:48 PM

Cleverly implementing the short animation and jump after clicking the a tag, many times, we hope that after clicking the a tag, the page can first display a short loading event...

What is the <figure> element in CSS for? What is the
element in CSS for? Apr 05, 2025 pm 04:51 PM

What are the elements in CSS for? During the learning and using CSS, you may encounter some less common HTML elements, such as &lt...

How to customize the resize symbol through CSS and make it uniform with the background color? How to customize the resize symbol through CSS and make it uniform with the background color? Apr 05, 2025 pm 02:30 PM

The method of customizing resize symbols in CSS is unified with background colors. In daily development, we often encounter situations where we need to customize user interface details, such as adjusting...

How to increase the height of the input element and make the text at the bottom? How to increase the height of the input element and make the text at the bottom? Apr 05, 2025 pm 02:51 PM

How to increase the height of the input element and make the text at the bottom? When we need to adjust the height of the input element in web design and hope that the text in it...

How to draw a specific shape with an orange background color using CSS' clip-path property? How to draw a specific shape with an orange background color using CSS' clip-path property? Apr 05, 2025 pm 04:36 PM

Practical application cases of CSS drawing function In modern web design, CSS can not only be used for layout and style, but also for creating complex graphics and animations. May...

See all articles