Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

138 CHAPTER 4 Getting started with CSS3


the W3C started working on various modules of CSS Level 3 (CSS3). Rather than creating one
large publication for CSS3, the W3C separated CSS3 into modules that could be published
independently.
In 2005, the W3C became stricter with enforcement of the requirements for standards, and
already-published standards such as CSS Level 2 Revision 1 (CSS 2.1), CSS3 Selectors, and CSS3
Text were pulled back from Candidate Recommendation to Working Draft level. It wasn’t until
June 2011 that the CSS 2.1 recommendation was published.
Because CSS3 is modular, the stability of each module differs, and its status differs. More
than 50 modules are published from the W3C’s CSS Working Group. At the time of this writ-
ing, the following four modules have reached recommendation status.
■■Media Queries Adapts the rendering of HTML documents based on conditions such
as screen resolution and orientation to accommodate different devices such as smart
phones and tablets.
■■Namespaces XML-based formats that can use namespaces to distinguish multiple
uses of the same element name from one another within the same document. This
publication explains how CSS selectors can be extended to select those elements
based on their namespace and on their local name.
■■Selectors Level 3 Describes the element selectors used in CSS when selectors are
used to select elements in an HTML or XML document to attach style properties.
■■Color pecifies the color-related aspects of CSS, including transparency and the variS -
ous representations of the <color> value type.
CSS 2.1 is included in CSS3 because CSS3 is being designed to be backward compatible
with the CSS 2.1 recommendation. This chapter introduces you to CSS3 by covering many
aspects of CSS 2.1.
Cascading style sheets provide a means to apply a presentation to an HTML structure by
defining how HTML elements are displayed. By using CSS, you can set background and fore-
ground colors, margins, borders, fonts, positions, and much more. You have creative control
of the HTML elements, so you can decide what the elements look like and where they display
on the screen.
If you have worked with a word processing application such as Microsoft Word, you might
have applied a style to change the font size of a word or paragraph. This is similar to CSS, in
which you can apply a style to an element that causes it to render differently. A style is a rule
that describes how to format a specific part of an HTML document. A style sheet is a set of
style rules.
You can create a style and apply it to many elements based on a selector. You use a
selector to locate and select elements based on tag name, class name, ID, and more. You can
create a style that works with images, and you can create a style that works only with hyper-
links. You can also create a named style that you can apply to any element. The reusability is
powerful.

Key
Te rms

Key
Te rms
Free download pdf