【问题标题】:Why can't I get csspie to work?为什么我不能让 csspie 工作?
【发布时间】:2012-12-30 10:27:59
【问题描述】:

我有一个要显示为彩色小圆圈的 div。我使用border-radius 属性添加了圆角,这当然可以在Firefox、Chrome 甚至IE9 中完美运行,但不能在IE 的早期版本中使用。我正在尝试使用CSSPIE 在早期版本的 IE 中渲染圆角。我下载了 PIE.htc 并将其保存在我的 css 文件夹中。

这是我的 css 的要点:

width: 25px;
height: 25px;
background-color: red;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
behavior: url(/PIE.htc);

但是,在 IE7 和 8 中,div 仍然显示为红色正方形而不是圆形。我做错了什么?

【问题讨论】:

    标签: internet-explorer rounded-corners css css3pie


    【解决方案1】:

    路径问题?

    替换:

    behavior: url(/PIE.htc);
    

    与:

    behavior: url("PIE.htc");
    

    编辑

    来自docs

    IE 解释行为属性相对于源的 URL HTML 文档,而不是像其他所有文件一样相对于 CSS 文件 CSS 属性。这使得调用 PIE 行为不方便, 因为 URL 必须是:

    1. Absolute from the domain root — this makes the CSS not easily moveable between directories — or,
    2. Relative to the HTML document — this makes the CSS not easily reusable between different HTML files.
    

    将路径更改为相对于 HTML 文件而不是相对于 css 文件。

    【讨论】:

    • 文档似乎没有表明需要引号:css3pie.com/documentation/getting-started。不过,我确实尝试过遵循您的建议,但没有帮助:(
    • 您的文件夹中的.htc 在哪里?
    • 直接和css文件在同一个文件夹中
    • 一个目录向上...谢谢!我更改了 url(/css/PIE.htc) 的路径,使其与 html 文件相关,现在可以正常工作了!
    • 现在的方式并不真正正确 - 修复它的不是引号。我会编辑你的答案然后接受它
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多