Home > Article > Web Front-end > How to set border color in css
The way to set the border color in css is to use the [border-color] attribute to set the color of the four borders. The [border-color] attribute is an abbreviated attribute that can set the color of the visible parts of all borders of an element. Or set different colors for the 4 sides.
The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.
How to set the border color in css:
css can use the border-color attribute to set the color of the four borders. 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.
css set border color:
<html> <head> <style type="text/css"> p.one { border-style: solid; border-color: #0000ff } p.two { border-style: solid; border-color: #ff0000 #0000ff } p.three { border-style: solid; border-color: #ff0000 #00ff00 #0000ff } p.four { border-style: solid; border-color: #ff0000 #00ff00 #0000ff rgb(250,0,255) } </style> </head> <body> <p class="one">One-colored border!</p> <p class="two">Two-colored border!</p> <p class="three">Three-colored border!</p> <p class="four">Four-colored border!</p> <p> <b>注释:</b>"border-width" 属性如果单独使用的话是不会起作用的。请首先使用 "border-style" 属性来设置边框。 </p> </body> </html>
Rendering:
The above is the detailed content of How to set border color in css. For more information, please follow other related articles on the PHP Chinese website!