Cascading Style Sheets (CSS) : An Introduction and Overview
Cascading Style Sheets (CSS) : An Introduction and Overview
Type questions in the Question and Answer area of the GoToWebinar bar
Agenda What are Cascading Style Sheets (CSS)? What can CSS do? Types of CSS What is Cascading? CSS rules What is Inheritance? Creating a Cascading Style Sheet Creating a custom style Applying a style sheet to documents
Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation (that is, the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can be applied to any kind of XML document, including SVG and XUL. Created by: CSS was created by Hkon Wium Lie and Bert Bos and was adopted as a W3C Recommendation in late 1996.
CSS Status
Current: CSS 2.1, adopted by the W3C in 2007 is the current recommendation. Future: CSS 3 has been broken into new categories and is under development. http://www.w3.org/Style/CSS/current-work#table Support: Early browser support was problematic leading many to ignore the CSS technology. Modern browsers may still have the occasional quirk, but CSS rendering has become quite reliable.
http://www.webdevout.net/browser-support-summary
A standards-based method for controlling the look and feel of XML content. Comprised of Rules to control elements in the document. Designed to separate formatting from the content while being flexible and scalable
Text formatting Element sizing Element positioning Change link attributes Cursor manipulation And more http://www.csszengarden.com/
Most importantly, CSS can support the control of hundreds or thousands of documents from a single control file This makes your life much easier when it is time to make updates
Types of CSS
Types of CSS
Embedded
Affects only the elements in a single file
External
Linked to an unlimited number of files
H1 Heading
Paragraph 1 Paragraph 2
H1 Heading
Paragraph 1 Paragraph 2
Embedded CSS
External CSS The <LINK> element is used to attach a CSS document to an HTML document <HEAD> <TITLE>New Topic1</TITLE> </HEAD>
What is Cascading?
Cascading The three CSS types combine at run time to render the page. Order of precedence Inline styles Embedded style sheets
CSS Rules
Embedded/ External
H1 {font-weight: bold}
Selector Declaration
What is Inheritance?
CSS Inheritance
XHTML elements inherit style attributes <body> <h1>Sample heading</h1> <p>Sample text</p> </body> body { font-family: Arial; }
H1 Heading
Paragraph 1 Paragraph 2
CLASS attribute The CLASS attribute can be used to create custom styles for a set of items on a page
P { color:blue; margin-left:3px; } P.myclass { color:blue; marginleft:3px; }
p.tip {color: #BEF5BF; font-weight: bold; background-color: #696969; padding-left: 0.8em; padding-right: 0.8em; padding-bottom: 0.3em; padding-top: 0.3em; border-bottom-color: #000000; border-bottom-style: Solid; border-bottom-width: 1px; border-top-color: #000000; border-top-style: Solid; border-top-width: 1px;}
<link href="test.css" rel="stylesheet" /> </head> <body> <h1>Heading 1 Text</h1> <p>A normal paragraph</p> <h2>Heading 2 Text</h2> <p>Another normal paragraph</p> <p class=tip>This paragraph will be a tip.</p> </body> </html>
External CSS The <LINK> element is used to attach a CSS document to an HTML document <HEAD> <TITLE>New Topic1</TITLE> </HEAD>
Cascading Style Sheets: Designing for the Web (3rd Edition) (Paperback) by Hakon Wium Lie and Bert Bos ISBN-13: 978-0321193124
CSS: The Definitive Guide, Third Edition by Eric Meyer ISBN-13: 978-0596527334
Questions?
Thank You!