链接相关问题 [英] link rel questions

查看:68
本文介绍了链接相关问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多年来,我已经找到了样式表的链接,例如

< link rel = stylesheet type =" text / css" href =" style.css">

这些页面都使用W3C验证器验证。


但是在查看W3C时,我注意到他们的例子show

< link rel =" stylesheet"类型= QUOT;文本/ CSS"引用样式表的href =" style101.css">

,因为其他属性是。


它以任何一种方式验证。


我应该引用stylesheet,因为它是另一个

属性吗?另外,为什么我没有得到验证错误我没有/ b
引用它?


另外,我有一个favicon.ico在我的服务器目录中,浏览器倾向于使用它来查找和使用它。现在我想在几个目录中添加个别的favicons到
。许多来源(包括一些浏览器网站)

建议这样做:


< link rel =" icon" HREF ="&的favicon.ico QUOT;类型= QUOT;图像/ X-图标" />

< link rel ="快捷方式图标" HREF ="&的favicon.ico QUOT;类型= QUOT;图像/ X-图标" />


我收集第二个是因为Internet Explorer期望它。


然而 http://www.w3.org/TR/html4/types.html#type-links 没有提到

提到icon或快捷图标或快捷图标。在公认的链接列表中

类型。它还说

链接类型中不允许使用空格字符。


我想W3C对配置文件的引用是允许它们的

用过吗? (实际上我删除了/因为我使用的是HTML 4.01而不是

XHTML)但是由于我没有指定配置文件,验证器是否正确

未标记一个错误,特别是在空白区问题上?


-
http://www.ericlindsay.com

For years I have had links to a stylesheet done like
<link rel=stylesheet type="text/css" href="style.css">
and these pages all validate with the W3C validator.

However in looking at W3C, I notice their examples show
<link rel="stylesheet" type="text/css" href="style101.css">
with the stylesheet quoted, as other attributes are.

It validates either way.

Should I be quoting "stylesheet", on the basis that it is another
attribute? Also, why wouldn''t I have a validation error when I didn''t
quote it?

Also, I have had a favicon.ico in my server directory, and browsers tend
to find and use it. Now I would like to add individual favicons to
several directories. Many sources (including some browser sites)
recommend doing that this way:

<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

I gather the second of these is because Internet Explorer expects it.

However http://www.w3.org/TR/html4/types.html#type-links makes no
mention of "icon" or "shortcut icon" in the list of recognised link
types. It also says "White space characters are not permitted within
link types."

I imagine the W3C reference to profiles is what permits these to be
used? (Actually I removed the / because I am using HTML 4.01 and not
XHTML) However as I didn''t specify a profile, is the validator correct
in not flagging an error, especially on the white space question?

--
http://www.ericlindsay.com

推荐答案

Eric Lindsay写道:
Eric Lindsay wrote :
多年来,我已经有了一个样式表的链接,如
< link rel = stylesheet type =" text / css" href =" style.css">
这些页面都使用W3C验证器进行验证。

然而,在查看W3C时,我注意到他们的示例显示
< link的rel ="样式表"类型= QUOT;文本/ CSS" href =" style101.css">
引用的样式表,如其他属性一样。

它验证两种方式。

我应该引用吗? ; stylesheet",基于它是另一个
属性?


是的,最好总是引用属性值。

为什么属性值应该始终用HTML引用
http://www.cs.tut.fi/~jkorpela/qattr.html

另外,为什么我没有引用验证错误?
For years I have had links to a stylesheet done like
<link rel=stylesheet type="text/css" href="style.css">
and these pages all validate with the W3C validator.

However in looking at W3C, I notice their examples show
<link rel="stylesheet" type="text/css" href="style101.css">
with the stylesheet quoted, as other attributes are.

It validates either way.

Should I be quoting "stylesheet", on the basis that it is another
attribute?
Yes, it is preferable to always quote attribute values.
Why attribute values should always be quoted in HTML
http://www.cs.tut.fi/~jkorpela/qattr.html
Also, why wouldn''t I have a validation error when I didn''t quote it?




[snipped]


例如为什么总是引用:


< table width =" 50%" ...>

将使用50%的直接容器创建一个表格



< table width = 50%.. 。>

将尝试创建一个50px的表。有时,由于内容

水平扩展表格单元格,表格将仅使用所需的

水平空间来呈现表格内容,然后是业余网站

作者认为宽度= 50%完全符合他们的需求。他们的代码

请求50px,他们得到400px,他们得出结论他们得到50%和

他们从不怀疑他们的代码有问题。


你的第二个问题也是一个有趣的...我相信它已经在之前得到了回答。你有没有搜索过这个新闻组中的档案帖子?

$ b $bGérard

-

删除等等给我发电子邮件



[snipped]

E.g. for why always quoting:

<table width="50%" ...>
will create a table using 50% of its immediate container
and
<table width=50% ...>
will try to create a table having 50px. Sometimes, due to content
expanding table cells horizontally, the table will use only the needed
horizontal space to render the table content and then amateur web
authors think that width=50% fits exactly their needs. Their code
requested 50px, they get, say, 400px and they conclude they got 50% and
they never suspect there is something wrong with their code.

Your 2nd question is also an interesting... which I am sure was already
answered before. Have you searched the archived posts in this newsgroup?

Gérard
--
remove blah to email me


文章< 43 ************* @ uni-berlin.de>,
$ b $bGérardTalbot< ne ***********@gtalbot.org>写道:
In article <43*************@uni-berlin.de>,
Gérard Talbot <ne***********@gtalbot.org> wrote:
我应该引用stylesheet,因为它是另一个
属性吗?
是的,总是引用属性值是最好的。
为什么属性值应该总是用HTML引用
http://www.cs.tut.fi/~jkorpela/qattr.html
Should I be quoting "stylesheet", on the basis that it is another
attribute?
Yes, it is preferable to always quote attribute values.
Why attribute values should always be quoted in HTML
http://www.cs.tut.fi/~jkorpela/qattr.html




谢谢你指的是Jukka的文章。我以为我已经读过他网站上的所有内容,但是没有记得,显然没有注意到,

那一个。它很好地解释了这种情况。


我会尝试写一些东西来检查我的网站是否缺少报价,因为

我无法确定通过验证器发现它们。

你的第二个问题也是一个有趣的......我相信之前已经回答过了。你有没有搜索过这个新闻组中存档的帖子?



Thank you for pointing me to Jukka''s article. I thought I had read
everything on his site, but didn''t recall, and apparently hadn''t noted,
that one. It explains the situation very well.

I will try to write something to check my site for missing quotes, since
I can''t be sure of spotting them via validator.
Your 2nd question is also an interesting... which I am sure was already
answered before. Have you searched the archived posts in this newsgroup?




我找不到我正在使用的搜索条件下的答案。但那个
可能只是意味着我仍在问错误的问题。我想我只需要继续使用建议的链接相关指针

favicon.ico,即使我认为它们与

规格。我试过的两个验证器没有标记它们。有时

这样我希望我的Mac上有一个HTML lint。


谢谢。


- -
http://www.ericlindsay.com


Eric Lindsay写道:
Eric Lindsay wrote:
< link rel ="快捷方式图标" HREF ="&的favicon.ico QUOT;类型= QUOT;图像/ X-图标" />
但是 http://www.w3 .org / TR / html4 / types.html #type-links 没有提及icon或快捷图标或快捷图标。在公认的链接类型列表中。


确实说:作者可能希望在本规范中定义未描述的其他链接类型

。如果他们这样做,他们应该使用个人资料来引用用于定义链接类型的

约定。


DTD不能表达 ;必须来自此列表,除非某些其他元素具有

指定的其他一些属性,因此其值不能这样做。我也不知道任何定义这些值的标准配置文件。 (然后有一个单词应该这个词,因为它应该在W3C规范中经常出现。应该是

而不是必须) />
它还说
链接类型中不允许使用空格字符。
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> However http://www.w3.org/TR/html4/types.html#type-links makes no
mention of "icon" or "shortcut icon" in the list of recognised link
types.
It does say: "Authors may wish to define additional link types not described
in this specification. If they do so, they should use a profile to cite the
conventions used to define the link types."

DTDs can''t express "Must be from this list unless some other element has
some other attribute specified", so its value to not do that. I''m also not
aware of any standard profile which defines those values. (Then there is
the word "should", which crops up far too often in W3C specs. "Should" is
not "Must")
It also says "White space characters are not permitted within
link types."




在DTD之后 ,%LinkTypes是指以空格分隔的链接列表

类型。


因此,从理论上讲,该代码应相当于:


< link rel ="快捷方式" HREF ="&的favicon.ico QUOT;类型= QUOT;图像/ X-图标" />

< link rel =" icon" HREF ="&的favicon.ico QUOT;类型= QUOT;图像/ X-图标" />


....但欢迎浏览器无法识别rel

属性采用空格分隔列表。


-

David Dorward< http://blog.dorward.me.uk/> < http://dorward.me.uk/>

首页是〜/ .bashrc的位置



Just after "In the DTD, %LinkTypes refers to a space-separated list of link
types."

So, in theory, that code should be equivalent to:

<link rel="shortcut" href="favicon.ico" type="image/x-icon" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />

.... but welcome to the world of browsers not recognising the the rel
attribute takes a space separated list.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


这篇关于链接相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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