如何在CSS中删除一系列图像的内部边框并保持外部边框连续?
我有一系列想要有边框的图像。我不希望图像之间有边框,但是当我将中间图像的边框设置为 0 时,顶部边框之间会出现间隙。
就像这样,中间有很多图像。
_____
|_____|
我尝试设置填充,但由于我的图像采用不同的形状,因此我不能为每种形状设置这么多特殊情况。
如何消除间隙,但仍然在图像形状周围保留单个连续边框。
编辑:我正在尝试制作一个游戏,如果一个人选择一张图片,它会突出显示与其周围相似的所有图片。就像宝石镶嵌一样,如果你突出显示一种颜色,相同颜色的瓷砖也会突出显示自己。图像大小相同,以网格图案排列。
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 .
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从图像中删除所有边框并将它们包装在
中:
然后只需对其应用 CSS:
Remove all borders from the images and wrap them in a
<div />
:Then just apply CSS to it: