Home >Web Front-end >Front-end Q&A >How to add borders in css
In CSS, you can set the border through the border attribute. The setting syntax of this attribute is such as "border: medium double rgb(250, 0, 255)".
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
In CSS, you can set the border attribute to set the border. border is a shorthand property that can set all border properties in one statement. You can set them in order of border-width, border-style, and border-color, or you can set these attributes individually.
Attribute value of the border attribute:
border-width: Specifies the width of the border.
border-style: Specifies the style of the border.
border-color: Specifies the color of the border.
Example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> p { border: medium double rgb(250, 0, 255) } </style> </head> <body> <p>Some text</p> </body> </html>
Rendering:
Border attribute introduction:
border-width attribute:
border-width shorthand property sets the width for all borders of an element, or for each border individually.
Only works when the border style is not none. If the border style is none, the border width is actually reset to 0. Negative length values are not allowed.
border-style attribute:
The border-style attribute is used to set the style of all borders of an element, or to set the border style for each side individually.
The border may appear only when this value is not none.
border-style value:
border-color attribute:
border-color attribute sets the color of the four borders. This property can set from 1 to 4 colors.
The border-color property is a shorthand property that can set the color of the visible parts of all borders of an element, or set different colors for each of the 4 sides.
Recommended learning: "css video tutorial"
The above is the detailed content of How to add borders in css. For more information, please follow other related articles on the PHP Chinese website!