Home>Article>Web Front-end> How to set div height in css

How to set div height in css

青灯夜游
青灯夜游 Original
2021-04-21 11:23:19 5722browse

In CSS, you can use the height attribute to set the div height. You only need to add the "height: height value;" style to the div element. The height attribute sets the height of an element, which defines the height of the element's content area, excluding padding, borders, or margins.

How to set div height in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

css sets div height

In css, you can use the height attribute to set the div height. Code example:

     
这是一些文本。 这是一些文本。 这是一些文本。 (默认高度)
这是一些文本。 这是一些文本。 这是一些文本。(高度设置为100px)

Rendering:

How to set div height in css

##Description:

The height attribute sets the element's high.

Note: The height attribute does not include padding, borders, or margins!

Attribute value:

Value Description auto default. The browser will calculate the actual height. Use px, cm and other units to define the height. Based on the percentage height of the block-level object that contains it.
length
%
For more programming-related knowledge, please visit:

Introduction to Programming! !

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

Statement:
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