DOCTYPE /背景图像疯狂! [英] DOCTYPE / background-image madness!

查看:58
本文介绍了DOCTYPE /背景图像疯狂!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计


我想增强我的网站以区分外部来自

" internal"的超链接那个。


为了这个目的,我写了以下两个小文件进行测试

目的:


C:\styles.css:


.extlink {

background:url( http://tc2.atspace.com/extlink.gif )不重复

正中;

padding-right:12px; }


C:\test.htm:


<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN"

" http://www.w3.org/TR/html4/loose.dtd">

< HTML>

< HEAD>

< LINK REL = StyleSheet HREF =" styles.css" TYPE =" text / css">

< / HEAD>

< BODY>

< A class = extlink href = zzz> WHATEVER< / A>

< / BODY>

< / HTML>


我要打开C:\test.htm直接来自我的硬盘,在我改变我的实际网站之前看看

背景图片的外观。


问题:


(1)如果我删除DOCTYPE

声明,IE6只显示背景图像。如果我保留该声明,它不会显示

图像,即使它仍然遵循''extlink''

样式的其他方面。添加或删除IE6网络标记 (MOTW)对此没有任何影响




(2)FireFox 1.5根本不显示图像 - 用或没有

DOCTYPE声明。


问题:


(1)为什么DOCTYPE阻止IE6显示图片?


(2)为什么FF根本不显示图像?


(3)我该怎么做才能解决这个,能够对我硬盘上的

文件进行本地测试吗?


我意识到它可能一切正常,当我复制所有的

我网站主机的相关文件。但我想知道为什么它*不能*工作

当我在我的电脑上本地运行它们时。一般来说,我喜欢在本地测试我的

更改,然后再将它们复制到我的网络主机上。


TIA,

TC( MVP MSAccess)
http://tc2.atspace.com

Hi folks

I want to enhance my website to distinguish "external" hyperlinks from
"internal" ones.

With that aim, I''ve written the following two small files for testing
purposes:

C:\styles.css:

.extlink {
background: url(http://tc2.atspace.com/extlink.gif) no-repeat
right middle;
padding-right: 12px; }

C:\test.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="styles.css" TYPE="text/css">
</HEAD>
<BODY>
<A class=extlink href=zzz>WHATEVER</A>
</BODY>
</HTML>

I want to open C:\test.htm directly from my hard disk, to see how the
background image looks, before I change my actual website.

Problems:

(1) IE6 only displays the background image if I remove the DOCTYPE
declaration. If I retain that declaration, it does not display that
image, even though it still obeys the other aspects of the ''extlink''
style. Adding or removing an IE6 "mark of the web" (MOTW) has no affect
on this, one way or the other.

(2) FireFox 1.5 does not display the image at all - with or without the
DOCTYPE declaration.

Questions:

(1) Why does the DOCTYPE stop IE6 displaying the image?

(2) Why doesn''t FF display the image at all?

(3) What should I do to resolve this, to enable local testing of the
files on my hard disk?

I realize that it will probably all work fine, when I copy all of the
relevant files to my web host. But I want to know why it *doesn''t* work
fine when I run them locally on my PC. Generally I like to test my
changes locally, before I copy them to my web host.

TIA,
TC (MVP MSAccess)
http://tc2.atspace.com

推荐答案

TC写道:
TC wrote:

.extlink {

background:url( http://tc2.atspace.com/extlink.gif)不重复

正中;
.extlink {
background: url(http://tc2.atspace.com/extlink.gif) no-repeat
right middle;



做正确的中心。

Make that right center.


padding-right:12px; }

< A class = extlink href = zzz> WHATEVER< / A>
padding-right: 12px; }
<A class=extlink href=zzz>WHATEVER</A>



使< a class =" extlink" href =" zzz"> WHATEVER< / a>

Make that <a class="extlink" href="zzz">WHATEVER</a>


我想直接从我的硬盘上打开C:\ test.htm,看看怎么样

背景图片看起来,在我更改我的实际网站之前。


问题:


(1)仅限IE6如果我删除DOCTYPE

声明,则显示背景图像。如果我保留该声明,它不会显示

图像,即使它仍然遵循''extlink''

样式的其他方面。
I want to open C:\test.htm directly from my hard disk, to see how the
background image looks, before I change my actual website.

Problems:

(1) IE6 only displays the background image if I remove the DOCTYPE
declaration. If I retain that declaration, it does not display that
image, even though it still obeys the other aspects of the ''extlink''
style.



通常这意味着你在代码中做错了什么,

IE将原谅如果你有它在Quirksmode,因为在Quirksmode它

不必须遵循W3C指南。


添加doctype,然后*验证您的代码*,并修复错误。如果

然后IE仍然没有显示你的背景,请来询问并显示一个

在线的例子,说明它不起作用。

Usually that means that you''ve done something wrong in the code, which
IE will "forgive" if you have it in Quirksmode, since in Quirksmode it
doesn''t "have to" follow the W3C guidelines.

Add the doctype, then *validate your code*, and fix the errors. If
then still IE doesn''t show your background, come asking and show an
online example of what it is that''s not working.


添加或删除IE6网络标记 (MOTW)对此,无论如何都不会影响

Adding or removing an IE6 "mark of the web" (MOTW) has no affect
on this, one way or the other.



*是什么*是网络的标记?

What *is* a mark of the web?


(2)FireFox 1.5不显示图像完全 - 有或没有

DOCTYPE声明。
(2) FireFox 1.5 does not display the image at all - with or without the
DOCTYPE declaration.



Firefox总是想遵循W3C建议;-)

Firefox always wants to follow the W3C recommendations ;-)


问题:


(1)为什么DOCTYPE会阻止IE6显示图像?
Questions:

(1) Why does the DOCTYPE stop IE6 displaying the image?



可能导致你的代码不好。

Probably cause your code wasn''t good.


(2)为什么不FF显示图像?
(2) Why doesn''t FF display the image at all?



见上文。

See above.


(3)我该怎么做才能解决这个问题,以启用本地测试在我的硬盘上的

文件?
(3) What should I do to resolve this, to enable local testing of the
files on my hard disk?



让你的代码变得更好。

Make your code good.


我意识到当我复制时它可能都会正常工作所有

相关文件到我的网站主机。但我想知道为什么它*不能*工作

当我在我的电脑上本地运行它们时。通常我喜欢在本地测试我的

更改,然后再将它们复制到我的网络主机。
I realize that it will probably all work fine, when I copy all of the
relevant files to my web host. But I want to know why it *doesn''t* work
fine when I run them locally on my PC. Generally I like to test my
changes locally, before I copy them to my web host.



好​​想。

但是,如果你在本地使用一个文件并且href为

文件: /// C:/ blabla,然后它会在本地工作,但不能在上传之后。

为了防止这样的意外,您可以考虑在本地安装一个

网络服务器好。 Apache是​​免费的:-)


-

Els http://locusmeus.com/




TC写道:

TC wrote:

.extlink {

background:url( http://tc2.atspace.com/extlink.gif )不重复
.extlink {
background: url(http://tc2.atspace.com/extlink.gif) no-repeat



PS。 ATSPACE不允许从外部对服务器上的图像进行热链接。

他们的服务器。因此,如果您单击上面的链接,它将失败并显示错误。

但我已使用以下(自由

linkable)图像重复整个过程: http://i.microsoft.com/h/en- us / i / msnlogo.gif

结果相同。


TC

PS. ATSPACE disallows hotlinking to images on their server from outside
their server. So if you click the link above, it fails with an error.
But I''ve repeated the whole process using the following (freely
linkable) image: http://i.microsoft.com/h/en-us/i/msnlogo.gif The
result was identical.

TC

< br>

TC写道:
TC wrote:

TC写道:
TC wrote:

> .extlink {
背景:网址( http://tc2.atspace.com /extlink.gif )不重复
> .extlink {
background: url(http://tc2.atspace.com/extlink.gif) no-repeat



PS。 ATSPACE不允许从外部对服务器上的图像进行热链接。

他们的服务器。因此,如果单击上面的链接,它将失败并显示错误。


PS. ATSPACE disallows hotlinking to images on their server from outside
their server. So if you click the link above, it fails with an error.



你确定吗?我点击了它,看到一个漂亮的小外部链接

图像。我认为你的意思是如果有一个非atspace
referer就会失败,当从一个页面调用它时就会出现这种情况,结合

与浏览器不会阻止引用者。

You''re sure? I did click it, and saw a nice little external link
image. I think you mean that it will fail if there is a non-atspace
referer, which would be the case when calling it from a page, combined
with a browser that doesn''t block the referer.


但我已经使用以下(自由

linkable)图像重复了整个过程: http://i.microsoft.com/h/ en-us / i / msnlogo.gif

结果完全相同。
But I''ve repeated the whole process using the following (freely
linkable) image: http://i.microsoft.com/h/en-us/i/msnlogo.gif The
result was identical.



:-)

-

Els http://locusmeus.com/


这篇关于DOCTYPE /背景图像疯狂!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆