使用自定义图像圆角

发布于 2024-09-17 00:45:30 字数 505 浏览 4 评论 0原文

我正在尝试使用图像创建一个带有圆角的盒子。我知道如何使用 CSS3,但我需要使用图像,因为我有一些带有阴影和透明度的定制角。

我需要的结果:

我已将盒子分成几个图像:

http://i37.tinypic.com/2w6b14g_th.png

我知道有很多关于这个主题的信息,但我最近几天一直在研究这个问题,从我读过的文章中我无法准确得到我需要的信息。问题似乎是我需要所有图像的背景具有一定的透明度(白色部分和阴影部分)。有人知道如何使用 div 来做到这一点吗?

I'm trying to create a box with round corners using images. I know how to use CSS3 but I need to use images as I have some custom made corners with shadow and transparency.

The result I need:

I have divided the box into several images:

http://i37.tinypic.com/2w6b14g_th.png

I know there is plenty of info about this topic, but I have been working with this for the last days and from the articles I've read I cannot get exactly what I need. The problem seems to be that I need the background of all images to have a some transparency (both the white part and the shadow part). Anyone has an idea on how to do this using divs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情归归情 2024-09-24 00:45:30

我个人最喜欢的技术是这个:更加圆角。查看演示页面:http://www.schillmania.com/projects/dialog2/。它完全符合您的要求。

另外,与其他技术不同,您不必剪切背景图像。

My personal favorite technique is this one: even more rounded corners. Look at the demo page: http://www.schillmania.com/projects/dialog2/. It does exactly what you want.

Plus, unlike other techniques, you don't have to cut up your background image.

韶华倾负 2024-09-24 00:45:30

我今天一直在用这种方式与圆角搏斗。我使用的是 GIF,其角点的颜色与背景颜色相同。因为这些是 GIF,所以角可能是透明的,但我不想担心“后面”的内容。但在你的情况下,GIF 会比 JPG 更好(这是你正在做的事情吗?),因为支持透明度,或者如果你不需要支持旧浏览器,那么 GIF 会比 PNG 更好。然后你也可以将背景颜色放入你想要的 DIV 样式中。

华泰

I've been wrestling with rounded corners in this way today. I'm using GIF's which have the corners in the colour of the background. Because these are GIF's the corners could be transparent, but I'd rather not worry about what's 'behind'. But in your situation a GIF would be better than a JPG(is this what you are doing?), as transparency is supported, or a PNG if you don't need to support old browsers. Then you can put the background colour in the style for the DIV is you want too.

HTH

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文