CSS3 边框图像

发布于 2024-11-28 04:16:43 字数 528 浏览 5 评论 0原文

我正在尝试在所有边缘周围实现 5px 渐变。我发现了多种方法可以在除 IE 之外的所有浏览器中执行此操作(-mos-border-colors 并应用 5 种单独的颜色、边框图像等...)。

我尝试过 CSS3 Pie,但似乎无法让它在 IE(任何版本)中运行。此列有多种尺寸,因此图像会很麻烦。

有人对此有任何解决方案吗?

    .col {
        border: 5px solid;
        -moz-border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
        -webkit-border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
        border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
        behavior: url(/htc/Support/assets/css/PIE.htc);
    }

I'm trying to achieve a 5px gradient around all edges. I've found multiple ways to do this in all browsers except for IE (-mos-border-colors and apply 5 separate colors, border-image, etc...).

I've tried CSS3 Pie, but can't seem to get it to function at all in IE (any version). There are multiple sizes for this column, so images would be a hassle.

Any one have any solutions for this?

    .col {
        border: 5px solid;
        -moz-border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
        -webkit-border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
        border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
        behavior: url(/htc/Support/assets/css/PIE.htc);
    }

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

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

发布评论

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

评论(4

梦回旧景 2024-12-05 04:16:43

也许 box-shadow 是您的一个选择,启用单色渐变/阴影......

header {
    box-shadow: 0 1em 2em #fff;
    -webkit-box-shadow: 0 1em 2em #fff;
    -moz-box-shadow: 0 1em 2em #fff; }

它真的需要在每个浏览器中看起来都一样吗?

Maybe box-shadow is an option for you, enabling monochrome gradients/shades…

header {
    box-shadow: 0 1em 2em #fff;
    -webkit-box-shadow: 0 1em 2em #fff;
    -moz-box-shadow: 0 1em 2em #fff; }

Does it really need to look identical in every browser?

庆幸我还是我 2024-12-05 04:16:43

一些跨浏览器解决方案: http://webdesignerwall.com/tutorials/cross-browser-css-渐变

请注意,并非所有浏览器都支持 CSS 渐变。为了安全起见,在对布局进行编码时不应依赖 CSS 渐变。它只能用于增强布局。

Some cross browser solutions: http://webdesignerwall.com/tutorials/cross-browser-css-gradient

Please note not all browsers support CSS gradient. To be safe, you shouldn't rely on CSS gradient when coding the layout. It should only be used for enhancing the layout.

一花一树开 2024-12-05 04:16:43

我尝试过 CSS3 Pie,但似乎无法让它在 IE 中运行
(任何版本)。

CSS3-Pie 有点棘手。尝试将 position:relative; 添加到要应用边框图像的元素。

I've tried CSS3 Pie, but can't seem to get it to function at all in IE
(any version).

CSS3-Pie is a bit tricky. Try adding position:relative; to the element you want to apply border image to.

泪之魂 2024-12-05 04:16:43

CSSpie 无法解析从样式表到图像的相对路径。如果您没有指定从文档根目录到图像的绝对路径,则 css 饼图无法找到它们。

在这里查看这个问题:
http://css3pie.com/documentation/known-issues/#relative-paths

csspie cannot resolve relative paths from your stylesheet to your images. If you do not specify absolute paths from document root to your images, css pie cannot find them.

See this issue here:
http://css3pie.com/documentation/known-issues/#relative-paths

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