12

我正在尝试使用PIE.htc,这是一个脚本,希望可以让我在 IE6-8 中使用 CSS3 功能。我也在使用 Cakephp(我越来越喜欢它了)

根据说明,我只需将 PIE.htc 文件粘贴到任何我想要的位置,然后添加behavior: url(path/to/PIE.htc);到 CSS 中。所以我有:

input[type=text]{
    width:348px;
    height:30px;
    border:1px solid #ddd;
    padding:3px;
    background:url(../img/formfieldbg.gif) repeat-x;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    vertical-align:top;
    behavior: url(path/to/PIE.htc);}

它还说: 注意:此路径是相对于正在查看的 HTML 文件,而不是调用它的 CSS 文件。

我正在使用 Cakephp,无论我为路径放什么,无论我将 PIE.htc 文件放在哪里,我都无法让它工作!当我在 IE6 中查看它时,我的输入仍然没有像在 FF 中那样可爱的圆角。

4

4 回答 4

14

尝试使用绝对路径:

behavior: url(/path/to/PIE.htc);

注意前导正斜杠。这样,无论当前页面是什么,.htc文件的路径都将保持不变。

完整的 URL 也可以:

behavior: url(//example.com/path/to/PIE.htc);

如果您确实使用了完整的 url,请使用协议相对 url,这样您在切换到 https 时就不会收到不安全的内容警告。

很多元素需要position:relativezoom:1在使用 PIE 以在 IE 中运行时,请确保检查已知问题页面并玩弄直到你让它工作。

于 2011-08-10T03:23:55.317 回答
1

您需要指定 pie.php 文件。其内容如下:

<?php
/*
This file is a wrapper, for use in PHP environments, which serves PIE.htc using the
correct content-type, so that IE will recognize it as a behavior.  Simply specify the
behavior property to fetch this .php file instead of the .htc directly:

.myElement {
    [ ...css3 properties... ]
    behavior: url(PIE.php);
}

This is only necessary when the web server is not configured to serve .htc files with
the text/x-component content-type, and cannot easily be configured to do so (as is the
case with some shared hosting providers).
*/

header( 'Content-type: text/x-component' );
include( 'PIE.htc' );
?>

那应该可以解决问题。

于 2012-04-20T18:53:06.533 回答
1

我将 CodeIgniter 与mod_rewrite一起使用。根据 Septagram 的回答,我得到了以下工作

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

#if the url contains PIE.php redirect to the folder containing PIE.php
RewriteCond %{REQUEST_URI} PIE.php$
RewriteRule ^.*$ css3pie/PIE.php [NC,L]

#else just redirect to index
RewriteRule ^.*$ index.php [NC,L]

希望这可以帮助某人

于 2013-09-13T13:42:27.880 回答
0

如果您碰巧在使用mod_rewrite,那么以下小技巧可能适合您:

RewriteRule /PIE.htc$ PIE.htc [L]

添加这个.htaccess,瞧!现在PIE.htc神奇地出现在每个文件夹中:)

于 2012-10-13T08:37:35.797 回答