为什么这个CSS没有被应用? [英] Why does this CSS not get applied?

查看:88
本文介绍了为什么这个CSS没有被应用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几张图片:



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">





...我想放置边框。我试过这个CSS:





...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?

推荐答案

您需要添加 border 属性,例如:



You need to add the border attribute, for example:

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


解决方案1样式的快捷方式:

A shortcut for the style of Solution 1:
border : solid 12px navy;



-SA


这篇关于为什么这个CSS没有被应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆