140 likes | 287 Views
Lesson 5 Introduction to Cascading Style Sheets. HTML and JavaScript BASICS, 4 th Edition. Barksdale / Turner. Objectives. Create a Cascading Style Sheet. Control hyperlink behavior with CSS. Create style classes. Share style classes among Web pages.
E N D
Lesson 5 Introduction to Cascading Style Sheets HTML and JavaScript BASICS, 4th Edition Barksdale / Turner
Objectives • Create a Cascading Style Sheet. • Control hyperlink behavior with CSS. • Create style classes. • Share style classes among Web pages. • Control HTML table appearance with CSS. 2
active cascading style Cascading Style Sheet .css CSS files hover look and feel normal style style class style sheets visited Vocabulary 3
Introduction • A style is simply a collection of one or more attributes that are applied to the visual components of a Web page. • A cascading style is a collection of one or more attributes that can be specified once within the header of a Web page and then applied to many instances of a particular tag. 4
Creating Cascading Style Sheets • A Cascading Style Sheet is a collection of one or more cascading style codes that has been extracted from the header of a Web page and stored in a separate file in a specific (CSS) format. • CSS makes it possible to customize the appearance and behavior of the Web site simply by changing the values in the style sheets. 5
Creating Cascading Style Sheets (continued) • By convention, Cascading Style Sheet files are always given a .css extension. Web page using a Cascading Style Sheet 6
Exploring Hyperlink Styles There are four possible states of a link. The normal state of a hyperlink is the way it appears when the mouse pointer is not over it and it has never been clicked. The hover state defines the link’s appearance when the mouse pointer is over it but has not yet been clicked. 7 7
Exploring Hyperlink Styles (continued) A link’s active state is when it has the focus on a Web page and pressing the mouse button gives it focus. The visited state specifies a link’s appearance after it has been clicked at least once. 8 8
Exploring Hyperlink Styles (continued) By default, many popular browsers display text hyperlinks in an underlined, blue font. Navigation bar with hover, active, and visited links 9 9
Working with Style Classes CSS technology allows you to define style classes that can be applied to certain tags without affecting other tags of the same type. A style class is a named group of attributes that are defined in a Cascading Style Sheet and that can be applied to specified tags within an HTML document. 10 10
Sharing Style Classes All that is required for two or more Web pages to share a style class is for these Web pages to link in the style sheet in which the style class is defined. Although not a requirement, this is often done when the Web pages sharing the class are all displayed in a common frameset. 11 11
Exploring Table Styles Tables support a variety of attributes that are used to define column widths, border thickness and style and other table features. HTML table using style classes 12 12
Exploring Table Styles (continued) Because it is common for Web designers to want different tables on their Web pages to have different attributes, this is a perfect opportunity to make use of style classes. 13 13
Summary In this lesson, you learned: • How to create a Cascading Style Sheet. • How to control hyperlink behavior with CSS. • How to create style classes. • How to share style classes among Web pages. • How to control HTML table appearance with CSS. 14