HTML and CSS Reference
In-Depth Information
Media targeting:
Today's digital content isn't just for the computer screen: you can easily print
a web page, view it on your smart phone, or even see it on your TV. CSS makes it possible to
change the look-and-feel of your content to suit the output device with radically different lay-
outs, removal or inclusion of page sections, and a completely different color scheme.
With CSS, web page styles are made up of one or more rules . A CSS rule is comprised of three main
parts: the selectors, the properties, and the values. For example, in the CSS rule depicted in Figure 4-1,
h1 is the selector, color is the property, and red is the value.
Selector
Value
Property
Fi Gure 4-1
After the selector, properties and values (collectively referred to as a declaration ) are enclosed in a
set of curly braces. Properties and values are separated by a colon and each declaration must end
with a semicolon. You can include multiple declarations for any selector. For example:
h1 {
color: red;
margin: 0;
padding: 5px;
}
As with HTML, white space is ignored in CSS, so you can apply line-returns
and indentation as needed to make your CSS rules more readable.
Moreover, you can specify multiple selectors for any set of declarations in a comma-separated list:
h1, h2, h3, h4 {
color: red;
margin: 0;
padding: 5px;
}
CSS is truly an integral part of modern web page creation and a further understanding of its
basic tenets and how it can be used as discussed in the following sections will further your work
with HTML.
Search WWH ::




Custom Search