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.
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:
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:
(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!