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.
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>
Run results:
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!