How to change the border color of img with css

WBOY
Release: 2021-11-25 17:37:02
Original
4171 people have browsed it

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>
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template