gpt4 book ai didi

html - 为什么在 CSS 文件中使用绝对路径时 CSS3 PIE 在子页面上不起作用?

转载 作者:太空宇宙 更新时间:2023-11-03 19:05:01 26 4
gpt4 key购买 nike

我有以下类(class):

a.greenbutton, input.greenbutton  {
/*background: url("../image/button.png") repeat-x scroll left top transparent;*/
behavior: url("/css3pie/PIE.php");
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
border-radius: 7px 7px 7px 7px;
cursor: pointer;
display: inline-block;
line-height: 11px;
padding: 6px 12px;
text-decoration: none;
background-color: green;
color: white;
position:relative;
z-index: 0;
}

PIE.php 文件位于/root/css3pie/

你可以看这里:

http://trashtalk.dk/

看看区别:

http://trashtalk.dk/Apple/iPhone

您甚至可以从以下位置下载文件:

http://trashtalk.dk/css3pie/PIE.php

我做错了什么?

最佳答案

你没有使用绝对路径,你使用的是相对路径。要回答您的问题,我需要知道您的 css 文件相对于根文件夹的位置。

因为...如果它是 root/styles/或其他什么,那么您的饼图规则需要在/csspie 内容之前有两个点“..”。

换句话说,代替:

behavior: url("/css3pie/PIE.php");

你需要:

behavior: url("../css3pie/PIE.php");

但这只是猜测,我需要先知道您的 css 文件/文件夹的位置。

好的,引用这个页面:

http://css3pie.com/documentation/known-issues/

The behavior URL

IE interprets the URL for the behavior property relative to the source HTML document, rather than relative to the CSS file like every other CSS property. This makes invoking the PIE behavior inconvenient, because the URL has to either be:

Absolute from the domain root — this makes the CSS not easily moveable between directories — or, Relative to the HTML document — this makes the CSS not easily reusable between different HTML files. URLs in PIE-interpreted CSS properties

PIE does not parse the CSS stylesheets (to do so would be unacceptably slow); it lets IE handle the parsing, selector querying, cascading, etc. and then simply asks it for the resulting property values. This means that when PIE gets a property value, it has no knowledge of the context from which that value originated.

As a result, for properties which contain URL values (such as border-image or -pie-background), PIE cannot resolve those URLs relative to the CSS file in which they appear. It resolves them instead relative to the JavaScript execution context, which is the location of the source HTML document.

干杯
干杯

更新:

确保您已经有条不紊地逐一尝试了所有这些:

  1. 行为:url("../css3pie/PIE.php");
  2. 行为:url("/../css3pie/PIE.php");
  3. 行为:url("http://trashtalk.dk/css3pie/PIE.php");

UHMMM...您的 CSS 中的 css3 饼图规则在哪里?我没看到它,你知道,像 -pie-background 之类的东西。

关于html - 为什么在 CSS 文件中使用绝对路径时 CSS3 PIE 在子页面上不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10660084/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com