div+css - CSS标准 - 5.8.3 Class selectors - Class选择器

div+css - CSS标准 - 5.8.3 Class selectors - Class选择器

Working with HTML, authors may use the period (.) notation as an alternative to the ~= notation when representing the class attribute. Thus, for HTML, div.value and div[class~=value] have the same meaning. The attribute value must immediately follow the "period" (.). UAs may apply selectors using the period (.) notation in XML documents if the UA has namespace specific knowledge that allows it to determine which attribute is the "class" attribute for the respective namespace. One such example of namespace specific knowledge is the prose in the specification for a particular namespace (e.g. SVG 1.1 [SVG11] describes the SVG "class" attribute and how a UA should interpret it, and similarly MathML 2.0 [MATH20] describes the MathML "class" attribute.)

Example(s):

For example, we can assign style information to all elements with class~="pastoral" as follows:

*.pastoral { color: green }  /* all elements with class~=pastoral */
or just
.pastoral { color: green }  /* all elements with class~=pastoral */

The following assigns style only to H1 elements with class~="pastoral":

H1.pastoral { color: green }  /* H1 elements with class~=pastoral */

Given these rules, the first H1 instance below would not have green text, while the second would:

Not green


Very green


To match a subset of "class" values, each value must be preceded by a ".".

Example(s):

For example, the following rule matches any P element whose "class" attribute has been assigned a list of space-separated values that includes "pastoral" and "marine":

p.marine.pastoral { color: green }

This rule matches when class="pastoral blue aqua marine" but does not match for class="pastoral blue".

Note. CSS gives so much power to the "class" attribute, that authors could conceivably design their own "document language" based on elements with almost no associated presentation (such as DIV and SPAN in HTML) and assigning style information through the "class" attribute. Authors should avoid this practice since the structural elements of a document language often have recognized and accepted meanings and author-defined classes may not.

Note: If an element has multiple class attributes, their values must be concatenated with spaces between the values before searching for the class. As of this time the working group is not aware of any manner in which this situation can be reached, however, so this behavior is explicitly non-normative in this specification.

[5.8.3 Class selectors - Class选择器 - CSS标准文档]

http://www.w3.org/TR/CSS21/selector.html#class-html

[class属性 - IE文档]

http://msdn2.microsoft.com/en-us/library/ms533560.aspx

[div+css - 关键词]

div css

[div+css - 论坛]

http://WebDev.board.newsmth.net/
http://WebGeeks.board.newsmth.net/
http://bbs.pku.edu.cn/, homepage看版
http://forum.csdn.net/SList/HTMLCSS/
http://groups.google.com/group/alt.html
http://groups.google.com/group/comp.infosystems.www.authoring.html
http://groups.google.com/group/comp.infosystems.www.authoring.stylesheets

[div+css - 工具]

Internet Explorer Developer Toolbar, http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en

The W3C Markup Validation Service:, http://validator.w3.org/

微软印刷技术 - 自由字体信息, TrueType, OpenType, ClearType:, http://www.microsoft.com/typography/default.mspx

微软印刷技术 - WEFT 3网页嵌入字体3, http://www.microsoft.com/typography/WEFT.mspx

微软印刷技术 - WEFT 3 - 网页嵌入字体3 - 下载, http://www.microsoft.com/typography/web/embedding/weft3/download.aspx

微软印刷技术 - WEFT 3 - 网页嵌入字体3 - 向导, http://www.microsoft.com/typography/web/embedding/weft3/wizard.aspx

微 软印刷技术 - WEFT 3网页嵌入字体3 - Wizard向导 - Create font objects创建字体对象, http://www.microsoft.com/typography/web/embedding/weft3/wizard.aspx#create

微 软印刷技术 - WEFT 3网页嵌入字体3 - Wizard向导 - Fonts to embed待嵌入字体, http://www.microsoft.com/typography/web/embedding/weft3/wizard.aspx#embed

[div+css - 常见问题]

较验div+css格式, http://validator.w3.org/
div+css的margin缩写方式
div+css的padding缩写方式
链接的:link,:visited,:hover,:active四种状态

div+css使用backgroundRepeat样式设置背景图片的显示方式, http://msdn2.microsoft.com/en-us/library/ms530721.aspx

page-break-before设置打印分布符

url()指示符, http://www.w3.org/TR/CSS21/syndata.html#value-def-uri

!important规则, http://www.w3.org/TR/CSS21/cascade.html#important-rules

table中直接输入的文字和其他标记设置不同的颜色

CSS标准中级联的文档, http://www.w3.org/TR/CSS21/cascade.html#cascade

[div+css - Firefox和IE浏览器兼容问题]

水平居中,Firefox使用margin-left: auto; margin-right: auto; IE6 使用text-align: center;
垂直居中,Firefox中使用display: table-cell; vertical-align: middle;可以实现div垂直居中,而IE6中则需要借助IE6中css的特点实现垂直居中。
!important标记,Firefox支持!important标记,IE6忽略!important标记,!important需要放在前面才能起作用
手形鼠标指针,使用cursor: pointer;
padding的尺寸,在Firefox中padding是计算在width之外的,而IE6是计算在width之内的
margin的尺寸,在IE6中带有float样式的元素的margin尺寸计算有误,需要借助padding和!important标记实现兼容

使用word-wrap设置自动折行, 仅对IE有效

  • 在Firefox下会丢失左侧的圆点

    Internet Explorer的CSS参考资料, http://msdn2.microsoft.com/en-us/library/ms531209.aspx

    用CSS实现cellSpacing属性效果, border-spacing: 10px; border-spacing: expression(this.cellSpacing=10);

    padding-right在IE6下导致抖动

    [div+css - CSS标准]

    Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification:级联样式表第2级第1次修改(CSS 2.1)规范, http://www.w3.org/TR/CSS21/

    4.3.2 Lengths长度, http://www.w3.org/TR/CSS21/syndata.html#length-units

    5.8.3 Class selectors - Class选择器 - CSS标准文档, http://www.w3.org/TR/CSS21/selector.html#class-html

    class属性 - IE文档, http://msdn2.microsoft.com/en-us/library/ms533560.aspx

    8.3 Margin properties: 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', and 'margin' - 8.3边距属性, http://www.w3.org/TR/CSS21/box.html#margin-properties

    8.5 Border properties边框属性, http://www.w3.org/TR/CSS21/box.html#border-properties

    9.5 Floats浮动, http://www.w3.org/TR/CSS21/visuren.html#floats

    background-image背景图片, http://www.w3.org/TR/CSS21/colors.html#propdef-background-image

    17.6.2 The collapsing border model压缩边框模型, http://www.w3.org/TR/CSS21/tables.html#collapsing-borders

    border-collapse压缩边框 - IE文档, http://msdn2.microsoft.com/en-us/library/ms533513.aspx

    [div+css - XHTML标准]

    5.6. Table Modules - Table模块, http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#sec_5.6.

    [div+css - 其他HTML问题]

    使用OPTGROUP对SELECT中的OPTION分组

    nowrap标记设置不自动折行, http://www.w3.org/TR/1998/REC-html40-19980424/struct/tables.html#adef-nowrap

    leftmargin设置页面左边距, topmargin设置页面上边距

    disabled属性, http://msdn2.microsoft.com/en-us/library/ms533732.aspx

    About Font Embedding:关于字体嵌入, http://msdn2.microsoft.com/en-us/library/ms533034.aspx
  • 你可能感兴趣的:(div+css)