Click here to Skip to main content
15,920,956 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have several images:

<img id="imgPostTravelTop" name="imgPostTravelTop" src="images/1_PTE_Top_Jig.png" alt="post Travel image" height="280" width="350">
<img id="imgPostTravelTopRight" name="imgPostTravelTopRight" src="images/2_PTE_Top_Right_Jig.png" alt="post Travel image" height="275" width="350">
<img id="imgPostTravelCenter" name="imgPostTravelCenter" src="images/3_PTE_Center_Jig.png" alt="post Travel image" height="275" width="350">
<img id="imgPostTravelBottom" name="imgPostTravelBottom" src="images/4_PTE_Bottom_Jig.png" alt="post Travel image" height="275" width="350">


...that I want to put borders around. I tried this CSS:

img {
  border-width: 12px;
  border-color: navy;
}


...and it did nothing; so, I tried this on one of the images:

.image {
  border-width: 12px;
  border-color: navy;
}


<img class="image" id="imgPostTravelTop" name="imgPostTravelTop" src="images/1_PTE_Top_Jig.png" alt="post Travel image" height="280" width="350">
. . .


...but that doesn't give me a border (on that particular image), either. Why not?
Posted

You need to add the border attribute, for example:

CSS
img {
  border : solid;
  border-width: 12px;
  border-color: navy;
}
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 22-Sep-15 21:30pm    
Correct, a 5. I added just 5 cents (well, less :-) in Solution 2. :-)
—SA
George Jonsson 22-Sep-15 22:16pm    
Thanks Sergey.
Shortcuts are handy when you know what you are doing.
Sergey Alexandrovich Kryukov 22-Sep-15 22:39pm    
Precisely. I hope our inquirer will get the message.
—SA
A shortcut for the style of Solution 1:
CSS
border : solid 12px navy;

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900