六角形图像

编程入门 行业动态 更新时间:2024-10-24 02:01:46
本文介绍了六角形图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 Circle Images

我可以使用 border-radius 获取圆形边框:

img { border-radius:50%;

六角形图像

虽然我希望创建六角形图片。我猜想将图片包装在 div / span (或其中一些)中是必需的。

类似以下任何一种:

For简单的缘故,所有图像都是正方形。 目标

像这样的图像是将它们堆叠成蜂窝状结构。我不会把这作为问题的一部分,因为如果我可以让我的图像呈现六角形,它应该是相对容易实现的。

解决方案

p>如何剪辑路径 ...

img {-webkit-clip - 路径:多边形(50%0%,100%25%,100%75%,50%100%,0%75%,0%25%);剪辑路径:多边形(50%0%,100% %,100%75%,50%100%,0%75%,0%25%);}

< img src =placehold.it/200>

这里有一个爵士乐工具生成剪辑路径属性。 以下是好文章,提供更多信息。

Circle Images

I can get circle borders using border-radius:

img { border-radius: 50%; }

Hexagonal Images

I'm hoping to create hexagonal images though. I'm guessing that wrapping the images in a div/span (or a few of them) will be required.

Something like either of these:

For simplicity's sake, all images are square.

Objective

The point of getting images like this is to stack them in a honeycomb like structure. I'm not putting this as part of the question as it should be relatively easy to achieve if I can get my images hexagonal.

解决方案

How about clip-path...

img { -webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }

<img src="placehold.it/200">

Here is a jazzy tool for easily generating the clip-path attribute. And here is a nice article with more information.

更多推荐

六角形图像

本文发布于:2023-11-30 02:39:00,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!