Home  >  Article  >  Web Front-end  >  How to set border color in css

How to set border color in css

coldplay.xixi
coldplay.xixiOriginal
2021-04-16 15:12:0214374browse

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.

How to set border color in css

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:

How to set border color in css

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!

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