使用框阴影创建边框?

时间:2017-12-06 19:14:17

标签: css css3

我正在尝试使用CSS box shadow为我的元素创建边框。 但是,我似乎无法让它发挥作用。

这是我的代码:



.vid_img{
display:inline-block; 
width:25%;
vertical-align: top;
 box-shadow: inset 0 0 0 -1px red;

}

<img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img"><img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img"><img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img"><img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img">
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

你可以这样做:

.vid_img {
  display: inline-block; 
  width: 25%;
  vertical-align: top;
  box-shadow: 0 0 0 1px red;
}
<img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img"><img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img"><img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img"><img src="https://static.pexels.com/photos/204611/pexels-photo-204611.jpeg" class="vid_img">