外部CSS和HTML 2.0 [英] External CSS and HTML 2.0

查看:57
本文介绍了外部CSS和HTML 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我一直在各种doctypes上运行测试和

发现了一些有趣的东西。


我设置了一个测试页面使用此doctype ...


<!DOCTYPE HTML PUBLIC" - // IETF // DTD HTML 2.0 Strict Level 1 // EN">


....并把它放在头上:


< link rel =" stylesheet"类型= QUOT;文本/ CSS" href =" http://www.example.com/test.css">


该页面未通过W3C验证器。将上述内容更改为......


< link rel =" stylesheet" href =" http://www.example.com/test.css">


....允许页面验证。


我已经告诉浏览器什么类型的文件test.css

在我的.htaccess文件中:


AddType''text / css; charset = US-ASCII''。css

AddCharset US-ASCII .css

AddLanguage en-US .css


I重复测试HTML 4.01严格和XHTML 1.1

页面(需要进行其他更改)并且仍然有效。


除了通常的Internet Explorer窒息在XHTML 1.1上

作为application / xhtml + xml,HTML 2.0,HTML 4.01严格

和XHTML 1.1测试页面都遵循指令
$ CSS文件中的b $ b就好了。我发现的唯一的怪癖是

W3C CSS Validator无法从HTML / XHTML

文件中找到CSS(但是当我指向它时,它会被验证) CSS文件)。


有什么理由可以解释为什么type =" text / css"在每个使用我能找到的外部CSS的例子中找到




-

Guy Macon < http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon.com/>

Guy Macon< http://www.GuyMacon.com/ Guy Macon< http://www.GuyMacon.com/>

Guy Macon< http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon。 com />

Guy Macon< http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon.com/>


I have been running tests on various doctypes and
found something interesting.

I set up a test page using this doctype...

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 1//EN">

....and put this in the head:

<link rel="stylesheet" type="text/css" href="http://www.example.com/test.css">

The page failed the W3C validator. Changing the above to...

<link rel="stylesheet" href="http://www.example.com/test.css">

....allowed the page to validate.

I already tell the browser what type of document test.css
is in my .htaccess file:

AddType ''text/css; charset=US-ASCII'' .css
AddCharset US-ASCII .css
AddLanguage en-US .css

I repeated the test with HTML 4.01 strict and XHTML 1.1
pages (making the other changes needed) and it still validated.

Other than the usual Internet Explorer choking on XHTML 1.1
served as application/xhtml+xml, the HTML 2.0, HTML 4.01 strict
and the XHTML 1.1 test pages are all following the directives
in the CSS file just fine. The only quirk I found was that the
W3C CSS Validator couldn''t find the CSS from the HTML/XHTML
file (but it validated when I pointed it at the CSS file).

Is there any good reason why that type="text/css" is found
in every example of using an extenal CSS that I can find?


-
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>

推荐答案

Guy Macon写道:
Guy Macon wrote:

我一直在各种doctypes上运行测试和

发现了一些有趣的东西。


我使用这个doctype建立了一个测试页...


<!DOCTYPE HTML PUBLIC" - / / IETF // DTD HTML 2.0 Strict Level 1 // EN">


...并把它放在头上:


< link rel =" stylesheet"类型= QUOT;文本/ CSS" href =" http://www.example.com/test.css">


该页面未通过W3C验证器。
I have been running tests on various doctypes and
found something interesting.

I set up a test page using this doctype...

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 1//EN">

...and put this in the head:

<link rel="stylesheet" type="text/css" href="http://www.example.com/test.css">

The page failed the W3C validator.



因为HTML 2.0不支持type属性。没问题,对吧?

Because HTML 2.0 didn''t support the type attribute. No problem there, right?


将上述内容更改为......


< link rel = "样式表" href =" http://www.example.com/test.css">


...允许页面验证。
Changing the above to...

<link rel="stylesheet" href="http://www.example.com/test.css">

...allowed the page to validate.



当然。

Sure.


>

我已经告诉浏览器什么文件类型test.css

在我的.htaccess文件中:


AddType''text / css; charset = US-ASCII''。css

AddCharset US-ASCII .css

AddLanguage en-US .css
>
I already tell the browser what type of document test.css
is in my .htaccess file:

AddType ''text/css; charset=US-ASCII'' .css
AddCharset US-ASCII .css
AddLanguage en-US .css



很有趣,但与HTML有效性完全无关。

Fascinating, perhaps, but wholly unrelated to HTML validity.


>

我用HTML 4.01 strict和XHTML重复测试1.1

页面(需要进行其他更改)并且仍然有效。
>
I repeated the test with HTML 4.01 strict and XHTML 1.1
pages (making the other changes needed) and it still validated.



type =" text / css"嵌入式样式信息是必需的
http://www.w3.org/TR/html401/present....html#h-14.2.3 。对于外部

样式表,要求不是那么清楚,但也许你会对
http://www.w3.org/TR/html401 /present...fying-external

,如果你还没有读过它?


这允许用户代理商,以避免为

不支持的样式表语言下载样式表。


我不知道stzle表格中可能包含的其他语言。克林贡语?

The type="text/css" is required for embedded style information as per
http://www.w3.org/TR/html401/present....html#h-14.2.3. For external
style sheets, the requirement is not so clear, but perhaps you will be
satisfied with the text (second bulleted item) at
http://www.w3.org/TR/html401/present...fying-external ,
in case you haven''t read it already?

"This allows the user agent to avoid downloading a style sheet for an
unsupported style sheet language."

I have no idea what other languages a stzle sheet might be in. Klingon?


[...]

有什么理由可以解释为什么这个类型=" text / css"在每个使用我能找到的外部CSS的例子中找到


[...]
Is there any good reason why that type="text/css" is found
in every example of using an extenal CSS that I can find?


>

-

Guy Macon< http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon.com/>

Guy Macon< http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon.com/>

Guy Macon< http://www.GuyMacon。 com / Guy Macon< http://www.GuyMacon.com/>

Guy Macon< http://www.GuyMacon.com/Guy Macon< http:// www。 GuyMacon.com/>

>
-
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>



你知道,每当我看到你这样做时,这真让我烦恼。

- -

John

如果我可以使用那个表达,那就试着成为一个好人。

You know, this really annoys me every time I see you do it.
--
John
Trying to be a nice guy, if I may use that expression.


在文章< ; 48 ********** @ news.bluewin.ch>,

John Hosking< Jo ** @ DELETE.Hosking.name.INVALIDwrote:
In article <48**********@news.bluewin.ch>,
John Hosking <Jo**@DELETE.Hosking.name.INVALIDwrote:

Guy Macon< http://www.GuyMacon.com/Guy Maco n< http://www.GuyMacon.com/>

Guy Macon< http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon.com />

Guy Macon< http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon.com/>

Guy Macon< http://www.GuyMacon.com/Guy Macon< http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>
Guy Macon <http://www.GuyMacon.com/Guy Macon <http://www.GuyMacon.com/>



你知道吗,这真的每当我看到你这样做时,我都会生气。


You know, this really annoys me every time I see you do it.



我也是这样,但另外,如果他赞不绝口,我会感到恼火。

没有。 />

-

dorayme

Me too but in addition, put it down to bias, I would be as annoyed if he
didn''t.

--
dorayme




John Hosking写道:

John Hosking wrote:

>
Guy Macon< http://www.GuyMacon.com/wrote:
>
Guy Macon <http://www.GuyMacon.com/wrote:

>我已经告诉浏览器我的.htaccess文件中有什么类型的文件test.css


AddType''text / css; charset = US-ASCII''.css
AddCharset US-ASCII .css
AddLanguage en-US .css
>I already tell the browser what type of document test.css
is in my .htaccess file:

AddType ''text/css; charset=US-ASCII'' .css
AddCharset US-ASCII .css
AddLanguage en-US .css


很有趣,但与HTML完全无关有效性。


Fascinating, perhaps, but wholly unrelated to HTML validity.



我相信它与HTML有效性有关。来自: http: //www.w3.org/TR/html401/present....html#h-14.2.1

|

|作者必须指定风格的样式表语言

|与HTML文档相关的信息。

|

| ...

|

|默认样式表语言也可以使用HTTP

|标头设置。以上META声明相当于

| HTTP标题:

|

| Content-Style-Type:text / css

|


....这当然是什么把


AddType''text / css; .css

.htaccess文件中的
在Apache服务器上运行。


我对此的看法(而且,似乎是w3C HTML Validator用于HTML 4.01 Strict的

DTD的作者是

,要求是指定样式表是

浏览器下载之前的文本/ css。这可以通过[type =" text / css"}来完成(并且通常是
)。 ]在调用外部样式表的

HTML docoment中的链接中,但它看起来像是通过提供服务来指定样式表是text / css吗? />
带有[Content-Style-Type:text / css] HTTP

标题的样式表也是有效的。


-


Microsoft Windows检测到一个过时的内部器官。


Microsoft移植向导正在准备你的身体

安装一个新的肾脏。请稍候...


您是否想备份现有肾脏? [是/否]


安装肾脏... 10 ... 20 ... 30 ... 40 ... 50 ... 60 ... 70 ......


" ERROR 31337:空间不足
腹腔内b $ b。删除肝脏

以创建额外的器官空间?


[确定]


I believe that it is related to HTML validity. From:
http://www.w3.org/TR/html401/present....html#h-14.2.1

|
|Authors must specify the style sheet language of style
|information associated with an HTML document.
|
|...
|
|The default style sheet language may also be set with HTTP
|headers. The above META declaration is equivalent to the
|HTTP header:
|
|Content-Style-Type: text/css
|

....which is, of course what putting

AddType ''text/css; .css

in the .htaccess file does on Apache servers.

My take on this (and, it seems, the take of the authors of the
DTD that the w3C HTML Validator uses for HTML 4.01 Strict) is
that the requirement is to specify that the style sheet is
text/css before the browser downloads it. This can be (and
usually is) done with [ type="text/css" ] in the link in the
HTML docoment that calls the external style sheet, but it looks
tp me that specifing that the style sheet is text/css by serving
the stylesheet with a [ Content-Style-Type: text/css ] HTTP
header is also valid.

--

Microsoft Windows has detected an outdated internal organ.

The Microsoft Transplant Wizard is preparing your body
for the installation of a new kidney. Please wait...

Do you wish to make a backup copy of your existing kidney? [Y/N]

Installing kidney...10...20...30...40...50...60...70...

"ERROR 31337: Insufficient space
in abdominal cavity. Delete liver
to create additional organ space?"

[OK]


这篇关于外部CSS和HTML 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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