Skip to Content
CSS:权威指南,第 5 版
book

CSS:权威指南,第 5 版

by Eric Meyer, Estelle Weyl
May 2025
Intermediate to advanced
1128 pages
15h 21m
Chinese
O'Reilly Media, Inc.
Content preview from CSS:权威指南,第 5 版

序言

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

如果你是一名网页设计师或文档作者,对复杂的页面样式、更好的可访问性以及省时省力感兴趣,本书就是为你准备的。在开始阅读本书之前,你真正需要了解的是 HTML 4.0。你对 HTML 了解得越多,准备得就越充分,但这并不是必要条件。你只需要知道很少的其他知识就可以学习本书了。

本书第五版完成于2022年底,尽力反映了当时的CSS发展状况。凡是详细介绍的内容,要么在编写时已得到浏览器的广泛支持,要么已知将在出版后不久得到支持。仍在开发中或已知即将支持的 CSS 功能在此不做介绍。

本书使用的约定

本书使用以下排版约定(但请务必通读"值语法约定",以了解其中一些约定是如何修改的):

斜体

表示新术语、URL、电子邮件地址、文件名和文件扩展名。

Constant width

用于程序列表以及段落中的程序元素,如变量或函数名、数据库、数据类型、环境变量、语句和关键字。

Constant width italic

显示应替换为用户提供的值或根据上下文确定的值的文本。

提示

该元素表示提示或建议。

备注

该元素表示一般性说明。

警告

该要素表示警告或注意事项。

值语法约定

在这本书中,方框解释了特定 CSS 属性的细节,包括哪些值是允许的。这些内容几乎是逐字逐句地从 CSS 规范中复制过来的,但还是要对语法做一些解释。

每个属性的允许值都用如下语法列出:

值:<family-name>#

值:<url> ‖ <color>

值:<url>? <color> [ / <color> ]?

值:[ <length> |thick |thin ]{1,4}

值:[ <background>, ]* <background-color>

<> 之间的任何 斜体字都给出了值的类型,或对另一个属性值的引用。 例如,属性font 接受原本属于属性font-family 的值。使用文本 <font-family>. 同样,如果允许使用颜色等值类型,则使用 <color>.

constant width 中的任何单词都是关键词,必须按字面意思出现,不加引号。正斜线 (/) 和逗号 (,) 也必须按字面意思使用。

值定义的组成部分可以多种方式组合:

  • 两个或多个关键字串在一起,中间只有空格隔开,表示所有关键字必须按指定顺序出现。例如,help me 表示属性必须按此顺序使用这些关键字。

  • 如果备选方案之间用竖条分隔 (X| Y),则其中任何一个备选方案都必须出现,但只能出现一个。 给定 [ X| Y| Z] 中的任意一个 X, Y, 或 Z中的任意一个。

  • 竖双杠 (XY) 表示 X, Y, 或两者都必须出现,但它们可以以任何顺序出现。 因此 X, Y, XYYX都是有效的解释。

  • 双括号 (X&& Y) 表示既 XY必须出现,尽管它们可以以任何顺序出现。因此 XYYX都是有效的解释。

  • 括号([...])用于将的内容组合在一起。 因此,[please ‖ help ‖ me]do this 表示pleasehelpme 可以以任何顺序出现,但每个词只能出现一次。do this 必须始终按此顺序出现。 下面是一些示例:please help me do this,help me please do this,me please help do this

每个组件或括号中的组后面都可以(或不可以)使用其中一个 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

学习 Java,第 6 版

学习 Java,第 6 版

Marc Loy, Patrick Niemeyer, Daniel Leuck
学习 React,第二版

学习 React,第二版

Alex Banks, Eve Porcello

Publisher Resources

ISBN: 9798341657021