[英]How do I remove the inside borders of a series of images and keep the outside border continuous in css?
I have a series of images that I want have border around. 我有一系列我想要的图像边框。 I don't want borders in between the images but when I set borders of the middle images to 0, I get a gap between the top borders . 我不希望图像之间有边框,但是当我将中间图像的边框设置为0时,我在顶部边框之间会出现间隙。
So something like this, with many images in the middle. 所以这样的事情,中间有很多图像。
_____
|_____|
I've tried setting the padding, but since my images take different shapes, I can't have so many special cases for each shape. 我已经尝试设置填充,但由于我的图像采用不同的形状,我不能为每个形状都有这么多特殊情况。
How do I remove the gaps but still keep a single continuous border around a shape of images. 如何消除间隙,但仍保持图像形状周围的单个连续边框。
Edit: I'm trying to make a game where if a person selects a picture, it highlights all the ones similiar to that around it. 编辑:我正在尝试制作一个游戏,如果一个人选择一张图片,它会突出显示与周围相似的所有图片。 Something like bejeweled, where if you highlight a colour, the same colour tiles highlight themselves. 像宝石迷阵的东西,如果你突出一个颜色,相同的颜色瓷砖突出自己。 Images are all the same size, layed out in a grid pattern. 图像大小相同,以网格图案布局。
Remove all borders from the images and wrap them in a <div />
: 从图像中删除所有边框并将其包装在<div />
:
<div class="image-wrapper">
<img />
<img />
...
<img />
</div>
Then just apply CSS to it: 然后只需应用CSS:
.image-wrapper {
border: 8px solid rgb(220, 220, 255);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.