What attributes are used in css to define the type of box

王林
Release: 2023-01-03 09:27:34
Original
2886 people have browsed it

The display attribute is used in css to define the type of box. The display attribute specifies the type of box that the element should generate, such as [display:inline], which means that the element will be displayed as an inline element without line breaks before and after the element.

What attributes are used in css to define the type of box

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

In css, we can use the display attribute to define the type of box. The following is a brief introduction to the display attribute.

Attribute introduction:

The display attribute specifies the type of box that the element should generate.

Attribute value:

  • none This element will not be displayed

  • block This element will be displayed as a block-level element. This element will be preceded and followed by line breaks

  • inline by default. This element will be displayed as an inline element, with no line breaks before and after the element

  • inline-block Inline block element. (New value in CSS2.1)

  • list-item This element will be displayed as a list

Example:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title>
<style>
p {display:inline}
</style>
</head>
<body>

<p>这两个段落生成内联盒子,和它的结果</p>

<p>这两个元素之间没有距离。</p>

</body>
</html>
Copy after login

Run results:

What attributes are used in css to define the type of box

Related recommendations: CSS tutorial

The above is the detailed content of What attributes are used in css to define the type of box. 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