Cascading Style Sheets

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email
Style sheet information is also part of the DOM. After defining style sheet or adding an in line style, you can view and alter any of the myriad of attributes that control its appearance.

Unlike Dynamic HTML and the Document Object Model, cascading style sheets exists as a real and accepted standard on the World Wide Web. Style sheets are in their first version accepted by the World Wide Web Consortium, and the standard is referred to as Cascading Style Sheet I (CSS1 ).

You use style sheets to control how HTML tags are formatted. The word 11 cascading" means that multiple styles can be used in an individual HTML page, and the browser will follow an order called a cascade to interpret the information.

Style Control With Style Sheets

The World Wide Web Consortium has released a definitive standard for style sheets, which is now reflected in Microsoft Internet Explorer 3.0 and later, and Netscape Navigator 4.0 and later.

There are three primary ways to use style sheets:

Inline Style Sheets

This approach exploits existing HTML tags within a standard HTML document and adds a specific style to the information controlled by those tags. An example would be controlling the indentation of a single paragraph using the style= "someStyle" attribute within the <P> tag. Another method of achieving this is by combining the <SPAN> tag and the style= "someStyle" attribute.

Embedded Style Sheets

This method enables the designer to control individual pages by using the <STYLE> tag, along with its companion tag, </STYLE>. This information is placed between the <HTML> tag and the <BODY> tag; the style attributes are inserted within the full <STYLE> container.

External (linked) Style Sheets

This is a master style sheet stored in an external file. It uses the same syntax of that of the embedded style. The file has an ext ension of css and this file has to be linked to the HTML document which requires those controls.

The attribute syntax for embedded and linked style sheets is somewhat different than standard HTML syntax. Attributes are placed within curly brackets, whereas HTML would place an equal (=) sing; a colon (:) is used , and individual, stacked arguments are separated by semicolons rather than commas. Also, several attributes are hyphenated, such as font style and margin left. A style sheet string would look like this:

(font style: arial, helvetica; margin left)

Still, as with HTML, style sheet syntax is very logical. As you work with the examples in this chapter, you should become quite comfortable with the way style sheets work.

When you refer to the style attributes as properties of an object, the hyphen disappears and the first letter of the second word is capitalized. So, font style becomes fontStyle, and text decoration becomes textDecoration

Of all the techniques for including style information in a web page, only linking to external style sheets an d,importing style sheets allow the style to cascade across, multiple pages. Imported style information is automatically included in the document, where as externally linked style information will be selected only it previously referenced style information is unavailable.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.