Please i need to know if i can change the color of an img border in html and how | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please i need to know if i can change the color of an img border in html and how

9th Dec 2022, 1:18 AM
Praise Onyemenam
Praise Onyemenam - avatar
4 Answers
+ 2
Try this <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <style> img { border: 5px solid #000000; } </style> <img src="https://assets-prd.ignimgs.com/2022/08/17/top25animecharacters-blogroll-1660777571580.jpg" alt="Example Image"> </body> </html>
9th Dec 2022, 2:11 AM
Calviղ
Calviղ - avatar
+ 1
With the attribute “border” you can change the color. Example: border: 10px solid blue
9th Dec 2022, 1:31 AM
Carlos Matheus
Carlos Matheus - avatar
+ 1
To change the color of an image border in CSS, you can use the following code: img { border-color: #000000; /* replace #000000 with the desired color code */ } Alternatively, you can also use the shorthand version: img { border: 2px solid #000000; /* replace 2px with the desired border width and #000000 with the desired color code */ }
9th Dec 2022, 1:43 AM
Calviղ
Calviղ - avatar
0
It didn't work, can you write out the code it the way it should be?
9th Dec 2022, 1:42 AM
Praise Onyemenam
Praise Onyemenam - avatar