本地HTML与外部CSS [英] Local HTML vs. External CSS

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

问题描述

嗨...


200多页网站的外部样式表标记为:


BODY,P, TABLE,TD,DIV {

背景:#ffffff;

font-style:normal;

font-variant:normal;

font-weight:normal;

font-size:1em;

颜色:#000000;

font-family: Verdana,sans-serif,arial;

}


我有一个单独的页面,我想要一个淡蓝色的背景,所以我

编码:


< LINK rel =" stylesheet"类型= QUOT;文本/ CSS" href =" gz.css"

title =" default">

< / HEAD>

< BODY bgcolor = "#80ffff" onLoad =" setTimeout(window.close,5000)">


页面验证为HTML 4.01过渡,但后台保持

white。我的印象是本地代码优先。


我真的必须去CLASS或ID选择器吗?


-

- 真的,Pete Collinson

Hi...

My external style sheet for a 200+ page site is marked up as:

BODY, P, TABLE, TD, DIV {
background: #ffffff;
font-style: normal;
font-variant: normal;
font-weight: normal;
font-size: 1em;
color: #000000;
font-family: Verdana, sans-serif, arial;
}

I have one solitary page on which I''d like a pale blue background, so I
coded:

<LINK rel="stylesheet" type="text/css" href="gz.css"
title="default">
</HEAD>
<BODY bgcolor="#80ffff" onLoad="setTimeout(window.close, 5000)">

The page validates as HTML 4.01 transitional, but the background stays
white. I was under the impression that local code takes precedence.

Do I really have to go to a CLASS or ID selector?

--
- Yours truly, Pete Collinson

推荐答案

文章< SX ****** ***************@news4.srv.hcvlny.cv.net> ;,彼得

Collinson写道:
In article <SX*********************@news4.srv.hcvlny.cv.net >, Peter
Collinson wrote:
嗨。 ..

200多页网站的外部样式表标记为:

BODY,P,TABLE,TD,DIV {
背景:# ffffff;
颜色:#000000;


是否有一些很好的理由说白色为黑色?

font-style:normal;
font-variant:normal;
font-weight:normal;


为什么?如果有人想要她的文字stange看,我打赌他有很好的

理由

字体大小:1em;


这也是多余的。

font-family:Verdana,sans-serif,arial;


你不应该将字体设置为特别是Verdana,也不应该。甚至没有。

}

我有一个单独的页面我想要一个淡蓝色的背景,所以我编码:

< LINK rel =" stylesheet"类型= QUOT;文本/ CSS" href =" gz.css"
title =" default">
< / HEAD>
< BODY bgcolor ="#80ffff" onLoad =" setTimeout(window.close,5000)">


你正在制作弹出窗口,不是吗?这是令人讨厌的。

页面验证为HTML 4.01过渡,但背景保持白色。我的印象是本地代码优先。


不,内联CSS优先于其他CSS。 HTML规则不是。那是

某个规格。 CSS1虽然有一些例外。

我真的必须去CLASS或ID选择器吗?
Hi...

My external style sheet for a 200+ page site is marked up as:

BODY, P, TABLE, TD, DIV {
background: #ffffff;
color: #000000;
Is there some good reason to say black on white?
font-style: normal;
font-variant: normal;
font-weight: normal;
Why? If someone wants her text stange looking, I bet he has very good
reason
font-size: 1em;
That is redundant too.
font-family: Verdana, sans-serif, arial;
You shouldn''t IMO set font to especially Verdana, nor at all.
}

I have one solitary page on which I''d like a pale blue background, so I
coded:

<LINK rel="stylesheet" type="text/css" href="gz.css"
title="default">
</HEAD>
<BODY bgcolor="#80ffff" onLoad="setTimeout(window.close, 5000)">
You are making popup, aren''t you? That''s nasty.
The page validates as HTML 4.01 transitional, but the background stays
white. I was under the impression that local code takes precedence.
No, inline CSS takes precedence over other CSS. HTML rules don''t. That is
somewhere in spec. CSS1 had some exeptions though.
Do I really have to go to a CLASS or ID selector?




不,你需要另一个样式表,或嵌入式样式块。

我建议使用另一个外部CSS。您需要拥有与正常风格相同的

标题

-

Lauri Raittila< http://www.iki。 FI / LR> < http://www.iki.fi/zwak/fonts>

Saapi l?hett ?? meili?,jos aihe ei liity ryhm ?? n,tai on yksityinen

tjsp。,mutta?l? L·海特? samaa viesti? meilitse ja ryhm ?? n。



No, you need another stylesheet, or embedded style block for that.
I''ll recommend using another external CSS. You need to it to have same
title as your normal style
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi l?hett?? meili?, jos aihe ei liity ryhm??n, tai on yksityinen
tjsp., mutta ?l? l?het? samaa viesti? meilitse ja ryhm??n.


Peter Collinson写道:


[snip]
Peter Collinson wrote:

[snip]
< LINK rel =" stylesheet"类型= QUOT;文本/ CSS" href =" gz.css"
title =" default">
< / HEAD>
< BODY bgcolor ="#80ffff" onLoad =" setTimeout(window.close,5000)">

页面验证为HTML 4.01过渡,但背景保持白色。我的印象是本地代码优先。
<LINK rel="stylesheet" type="text/css" href="gz.css"
title="default">
</HEAD>
<BODY bgcolor="#80ffff" onLoad="setTimeout(window.close, 5000)">

The page validates as HTML 4.01 transitional, but the background stays
white. I was under the impression that local code takes precedence.




No.样式属性被视为在选择器中有id。

这意味着它们具有很高的特异性:


< URL:http://www.w3.org/TR/REC-CSS2/cascade.html#specificity>


虽然您没有使用样式属性,但您使用了弃用的HTML。

非CSS表示提示的特异性较低:


< URL:http://www.w3.org/TR/REC-CSS2/cascade.html#specificity>


换句话说,使用CSS而不是过时的,表现性的HTML残存,或

被视为二等www公民:)


-

Jim Dabell



No. style attributes are treated as though they have an id in the selector.
This means that they have a high specificity:

<URL:http://www.w3.org/TR/REC-CSS2/cascade.html#specificity>

You haven''t used a style attribute though, you have used deprecated HTML.
Non-CSS presentational hints have a low specificity:

<URL:http://www.w3.org/TR/REC-CSS2/cascade.html#specificity>

In other words, use CSS instead of obsolete, presentational HTML cruft, or
be treated like a second-class www citizen :)

--
Jim Dabell


Jim Dabell< ji ******** @ jimdabell.com>写道:
Jim Dabell <ji********@jimdabell.com> writes:
编号样式属性被视为在选择器中有一个id。
这意味着它们具有很高的特异性:

< URL :http://www.w3.org/TR/REC-CSS2/cascade.html#specificity>
No. style attributes are treated as though they have an id in the selector.
This means that they have a high specificity:

<URL:http://www.w3.org/TR/REC-CSS2/cascade.html#specificity>




虽然许多浏览器将其特异性解释为无限而非

比100.


-

Chris



Though many browsers interpret their specificity as infinite rather
than 100.

--
Chris


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

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