Home  >  Article  >  Web Front-end  >  How to change the border color of img with css

How to change the border color of img with css

WBOY
WBOYOriginal
2021-11-25 17:37:024159browse

In CSS, you can use the "border-color" attribute to change the border color of img. The function of this attribute is to set the border color of the element. You only need to add "border-color: color value; "Style is enough.

How to change the border color of img with css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to change the border color of img in css

In css, you can use the border attribute to change the border color of img. Let’s look at the example below. The specific operation, the example is as follows:

<html>
<style type="text/css">
img{
border-style: solid;
border-width: 10px;
border-color:red;
}
</style>
<body>
<img src="/i/eg_tulip.jpg"  alt="上海鲜花港 - 郁金香" />
</body>
</html>

Output result:

How to change the border color of img with css

At this time, the img border color is red. Next, we pass the border attribute, The color of the table border can be:

<html>
<style type="text/css">
img{
border-style: solid;
border-width: 10px;
border-color:blue;
}
</style>
<body>
<img src="/i/eg_tulip.jpg"  alt="上海鲜花港 - 郁金香" />
</body>
</html>

Output result:

How to change the border color of img with css

(Learning video sharing: css video tutorial)

The above is the detailed content of How to change the border color of img with 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
Previous article:How to call class in cssNext article:How to call class in css