div#header vs. #header [英] div#header vs. #header

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

问题描述

我正在重新调整我的设计习惯,试图摆脱一些精神错误的b $ b b文物,并试图标准化。我的出发点模板

(包括html和css)。我也试图避免使用div-itis。我发现

我自己使用div#header这样的选择器而不仅仅是#header。我知道

div#header和#header都指向同一个目标,而且(对我而言)

很容易看出究竟是什么样式应用于。任何

想法,赞成和反对,一种方法与另一种方法?

I am retooling my design habits, trying to get rid of some mental
artifacts, and trying to "standardize" my starting point "templates"
(both html and css). I am also trying to avoid "div-itis." I find
myself using selectors like div#header instead of just #header. I know
that div#header and #header both refer to the same target, and (for me)
it is easy to see exactly what the style is being applied to. Any
thoughts, pro and con, on one method versus the other?

推荐答案

2007- 09-22,William Gill写道:
On 2007-09-22, William Gill wrote:

我正在重新调整我的设计习惯,试图摆脱一些精神上的b
文物,并尝试标准化我的出发点模板

(包括html和css)。我也试图避免使用div-itis。我发现

我自己使用div#header这样的选择器而不仅仅是#header。我知道

div#header和#header都指向同一个目标,而且(对我而言)

很容易看出究竟是什么样式应用于。任何

的想法,赞成和反对,一种方法与另一种方法?
I am retooling my design habits, trying to get rid of some mental
artifacts, and trying to "standardize" my starting point "templates"
(both html and css). I am also trying to avoid "div-itis." I find
myself using selectors like div#header instead of just #header. I know
that div#header and #header both refer to the same target, and (for me)
it is easy to see exactly what the style is being applied to. Any
thoughts, pro and con, on one method versus the other?



不一定适用于同一目标。没有指定

''div'',该样式可以应用于id =" header"

的任何标签(当然,必须只有一个在单页中。


如果你想将这些样式应用于一个文件中的div#header和另一个文件中的
h1#header,请使用#header 。如果您只想将它​​们应用于

div#header,那么请使用它。


-

Chris FA Johnson< http://cfaj.freeshell.org>

================================ ================== =================

作者:

Shell Scripting Recipes:问题解决方案(2005,Apress)

The do not necessarily apply to the same target. Without specifying
''div'', the style could be applied to any tag with id="header"
(though, of course, there must be only one in a single page).

If you want to apply those styles to div#header in one file and
h1#header in another, use #header. If you only want them applied to
div#header, then use that.

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)


Chris FA Johnson写道:
Chris F.A. Johnson wrote:

不一定适用于同一目标。没有指定

''div'',该样式可以应用于id =" header"

的任何标签(当然,必须只有一个在一页中)。
The do not necessarily apply to the same target. Without specifying
''div'', the style could be applied to any tag with id="header"
(though, of course, there must be only one in a single page).



所以,就像我说的,他们引用相同的目标(在任何给定页面上).-)

So, like I said, they refer to the same target (on any given page.) :-)


如果你想将这些样式应用于一个文件中的div#header和另一个文件中的
h1#header,请使用#header。如果您只想将它​​们应用于

div#header,那么请使用它。
If you want to apply those styles to div#header in one file and
h1#header in another, use #header. If you only want them applied to
div#header, then use that.



好​​点。我实际上并没有考虑过根据给定的ID设置不同的页面上的标签,但这往往会打败我的

标准化。理论。


我仍​​然喜欢通过查看样式表(即div#)来了解

页面上的div数量的想法header,div#copy,

div#footer,div#etc ...)。

Good point. I actually hadn''t thought about having tags on different
pages styled per a given ID, but this tends to defeat my
"standardization" theory.

I still like the idea that I can get a feel for the number of divs on a
page by looking at the stylesheet (i.e. div#header, div#copy,
div#footer, div#etc ...).


Scripsit William Gill:
Scripsit William Gill:

Chris FA Johnson写道:
Chris F.A. Johnson wrote:

>不一定适用于同一目标。如果没有指定''div'',则可以将样式应用于任何带有
id =" header"的标记。 (当然,
单页中一定只有一个)。
> The do not necessarily apply to the same target. Without
specifying ''div'', the style could be applied to any tag with
id="header" (though, of course, there must be only one in a
single page).



所以,就像我说的,他们引用相同的目标(在任何给定的页面上。)

:-)


So, like I said, they refer to the same target (on any given page.)
:-)



否,在任何有id =" header"的页面上任何元素中的属性不是
a div元素,#header引用该元素,而div#header不引用
引用任何元素。

-

Jukka K. Korpela(Yucca)
http://www.cs.tut.fi/~jkorpela/

No, on any page that has an id="header" attribute in any element that is not
a div element, #header refers to that element whereas div#header does not
refer to any element.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


这篇关于div#header vs. #header的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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