Chapter 3
CSS
Cascading Style Sheets (CSS) is a language for specifying various aspects of the
style of HTML elements. In this section we will provide only an overivew of
the most common uses of CSS. The reader who want to go into more depth can
visit the official source for CSS, the World Wide Web Consortium site at
http://www.w3.org/Style/CSS
There are several ways of adding style to HTML. We will focus on the inline
method and discuss the other methods briefly at the end.
3.1
The Style Attribute
The key idea behind CSS is that it provides uniform methods for defining the
style of HTML elements. The style attribute is one such method.
Every HTML element in the body of an web page can have a style attribute.
The style attribute has the form:
style="Prop1:Value1; Prop2: Value2; ... ; PropN: ValueN"
Observe that the style specification is enclosed in double quotes and consists of
a sequence of Prop:Value specifiers, separated by semicolons.
There are eight basic properties: font, color, background, margin, padding,
border, width, height. These are applied to an HTML element by imagining
that the element is contained in an invisible box. The element can be as small
as a single charater,chapter like word. At the other extreme, the
box for the body tag is the entire web page.
3.2
Parent and Children styles
As you have noticed, many HTML elements can contain other HTML elements.
For example, the body element can contain heading, paragraphs, tables, etc. We
37
Php Web Hosting Introduction to Interactive Web Design Php Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |