How to change the height of inline elements in css

王林
Release: 2023-01-03 09:28:35
Original
2928 people have browsed it

How to change the height of inline elements in css: You can use the line-heihgt attribute to set the height of inline elements, such as [line-height:100px;]. The line-height property is used to set the line height in percentage.

How to change the height of inline elements in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

The line-height attribute is a very important attribute in CSS. This attribute is used to set the line height in percentage. It should be noted that negative values ​​are not allowed.

Attribute value:

  • normal Default. Set reasonable line spacing.

  • #number Set a number, which will be multiplied by the current font size to set the line spacing.

  • #length Set a fixed line spacing.

  • % % line spacing based on the current font size.

  • #inherit Specifies that the value of the line-height attribute should be inherited from the parent element.

Sample code:

(Learning video sharing: css video tutorial)

Set the height of inline elements and make the text vertical Horizontal centering

    span {
      background: red;
      line-height: 100px;
      align-items: center;
      display: flex;
      justify-content: center;
    }
Copy after login

Related recommendations:CSS tutorial

The above is the detailed content of How to change the height of inline elements in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!