Cascading Style Sheet (Css)

Only available on StudyMode
  • Pages : 6 (1637 words )
  • Download(s) : 133
  • Published : March 2, 2013
Open Document
Text Preview
topicNine
Cascading Style Sheet
Learning Objectives
At the end of this chapter the students should be able to:
To use class selector to apply styles into html attributes. To use style sheet to give all web pages of the websites the same format and layout. To specify standard font, font color, font size, and others aspect of text To create a style sheet that governs the total appearance of the whole website. To specify the form styles of the web pages.

Introduction
What is CSS?
CSS stands for Cascading Style Sheets
Styles define how to display HTML elements
Styles are normally stored in Style Sheets
Styles were added to HTML 4.0 to solve a problem
External Style Sheets can save you a lot of work
External Style Sheets are stored in CSS files
Multiple style definitions will cascade into one

Style Sheets Can Save a Lot of Work
Styles sheets define HOW HTML elements are to be displayed, just like the font tag and the color attribute in HTML 3.2. Styles are normally saved in external .css files.
External style sheets enable you to change the appearance and layout of all the pages in your Web, just by editing one single CSS document. CSS is a breakthrough in Web design because it allows developers to control the style and layout of multiple Web pages all at once. As a Web developer you can define a style for each HTML element and apply it to as many Web pages as you want. To make a global change, simply change the style, and all elements in the Web are updated automatically. Multiple Styles Will Cascade Into One

Style sheets allow style information to be specified in many ways. Styles can be specified inside a single HTML element, inside the element of an HTML page, or in an external CSS file. Even multiple external style sheets can be referenced inside a single HTML document.  Cascading Order

What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority: Browser default

External style sheet
Internal style sheet (inside the tag)
Inline style (inside an HTML element)

Cascading Order
So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style declared inside the tag, in an external style sheet, or in a browser (a default value).

The advantages of using Cascading Style Sheet
CSS : Syntax
The CSS syntax is made up of three parts: a selector, a property and a value

selector {property: value}

The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces CSS : Syntax

The CSS syntax is made up of three parts: a selector, a property and a value

selector {property: value}

The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces

CSS : Syntax

A Property's Value
Each CSS property has different rules about what values it can accept. Some properties only accept one of a list of predefined values. Others accept numbers, integers, relative values, percentages, URLs, or colors. Some can accept more than one type of value.

A Property's Value: Inherit
You can use the inherit value for any property when you want to explicitly specify that the value for that property be the same as that of the element's parent.

A Property's Value:Predefined Values
Most CSS properties have a few predefined values that can be used. For example, the display property can be set to block, inline, list-item, or none. In contrast with HTML, you don't need to and indeed must not enclose...
tracking img