The Basics of Style Sheets Presented by Barry Diehl

Slides:



Advertisements
Similar presentations
1 © Netskills Quality Internet Training, University of Newcastle Introducing Cascading Style Sheets © Netskills, Quality Internet.
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Cascading Style Sheets
Cascading Style Sheets (CSS) “Styles” for short. Pg. 418.
Cascading Style Sheets
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
It’s All About Style The Basics of Style Sheets Presented by Barry Diehl.
CSS. CSS, or Cascading Styles Sheets, is a way to style HTML. Whereas the HTML is the content, the style sheet is the presentation of that document.
Introduction to CSS.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Chapter 8 Creating Style Sheets.
Chapter 6 Web Typography
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
Cascading Style Sheets Controlling the Display Of Web Content.
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
CSS Cascading Style Sheets By Garrett Garman. CSS Why use Style Sheets? Separates Appearance and Structure Modularity Quick and Easy changes Flexibility.
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Css. Definition Cascading style sheet (CSS) Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
Working with Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 5.
CO1552 – Web Application Development Cascading Style Sheets.
Cascading Style Sheets CSS. Source W3Schools
Cascading Style Sheets
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
How to… Cascading Style Sheets. How to Insert a Style Sheet When a browser reads a style sheet, it will format the document according to it. There are.
CASCADING STYLE SHEET CSS. CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Cascading Style Sheets (CSS)
CSS Cascading Style Sheets
Web Development & Design Foundations with XHTML
4.01 Cascading Style Sheets
An Introduction to Cascading Style Sheets
Introduction to CSS.
Cascading Style Sheets
Cascading Style Sheets
Madam Hazwani binti Rahmat
>> CSS Rules Selection
CX Introduction to Web Programming
Introduction to Web programming
Dynamic HTML.
Cascading Style Sheets
CASCADING STYLE SHEET CSS.
Introduction to CSS.
Cascading Style Sheets
Introduction to Cascading Style Sheets (CSS)
Web Programming– UFCFB Lecture 11
Working with Cascading Style Sheets (CSS)
Working with Cascading Style Sheets (CSS)
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets
Tutorial 3 Working with Cascading Style Sheets
Web Design and Development
Introduction to CSS.
Chapter 6 Introducing Cascading Style Sheets
Made By : Lavish Chauhan & Abhay Verma
Session 3: Basic CSS Spring 2009
Stylin’ with CSS.
4.01 Cascading Style Sheets
Introduction to Cascading Style Sheets (CSS)
CS332A Advanced HTML Programming
Presentation transcript:

The Basics of Style Sheets Presented by Barry Diehl It’s All About Style The Basics of Style Sheets Presented by Barry Diehl

Overview What are Style Sheets? Benefits of CSS Problems with CSS Recommendations Sources

What are style sheets? A collection of rules that determines how a browser displays HTML tags. Also known as Cascading Style Sheets (CSS). Consists of two parts: Selector – the HTML tag the style will affect Style – has a property and a value

Inline Styles – Add to a tag No selector Applies to the tag in which it belongs <P style=“font-size: 18 pt”>Paragraph text here</P> Best used as an exception to regular rules

Inline Styles - <SPAN> tag Define an area over which a style will be applied Not attached to a structural HTML element <SPAN style=“margin-left: 1in”> <H2>Heading</H2> <P>Paragraph text.</P> </SPAN>

Internal Styles Applies to entire document Insert <STYLE> tag between <HEAD> tags <HEAD> <TITLE>Page Title</TITLE> <STYLE TYPE=“text/css”> BODY {background: white; color: black} H1 {font: 24 pt “Arial” bold} P {font: 12 pt “Arial”; text-indent: 0.5in} </STYLE> </HEAD>

External Style Sheet Style data are kept in a separate file <HEAD> <TITLE>External Style Example</TITLE> <LINK REL=STYLESHEET HREF=“global.css” TYPE=“text/css”> </HEAD> <STYLE> is not in the file

Comparison – Inline Styles Useful for setting styles for small sections of a document Can override all other style specification methods Combining style with content and structural information Doesn’t apply to same tag elsewhere in document or other documents

Comparison – Internal Styles Useful for setting styles for an entire document Can use classes to create styles for multiple types of tags Style information is included when the document downloads for faster rendering Cannot be used for multiple documents

Comparison – External Style Sheet Standardize styles for a site Can use classes to create styles for multiple types of tags If used repeatedly, will be cached for faster retrieval Requires extra time to download a separate file Documents may not render correctly if there’s an error with the style sheet file Hard to make small changes in the document

Defining Styles with CLASS Add styles to a specific tag <STYLE TYPE=“text/css”> BODY {background: white; color: black; font-size: 14pt} P.large {font-size: 18pt} P.small {font-size: 10pt} </STYLE> <P CLASS=“large”>This paragraph will be large.</P> <P CLASS=“small”>This paragraph will be small.</P> Add styles without a tag – just have a period before the class name

Handling Exceptions with ID Assign exception value to an id using the # sign Use the id to change a value in a style <STYLE TYPE=“text/css”> .normal {font-size: 16; color: blue} #fire {color: red} </STYLE> <P CLASS=“normal”>Normal text is 16-point blue.</P> <P CLASS=“normal” ID=“fire”>This text is 16-point red.</P>

Inheritance Styles are inherited from previous definitions of tags <STYLE TYPE=“text/css”> BODY {background: white; color: black; font-size: 12pt} H1 {font-size: 24pt; color: green} UL {font-size: 10pt; font-style: italic} </STYLE>

Cascading Collecting, sorting and applying rules A rule’s importance is based on: If it has an explicit weight (“!important”) Where the rule originated Designer User Browser How specific the rule is Order of presentation (recent has priority)

Benefits of CSS Standardize pages across a web site Save bandwidth/load faster Develop faster Change pages quickly and easily Easy to learn and use Separates presentation and content

Problems with CSS Browser implementation varies – until 6.0, Netscape was the worst Style sheets won’t allow pages to be identical on all screens – there are too many variables

Recommendations 86% of Internet users surf with Internet Explorer Determine percentage for your own site Use pixels – only safe method – points are good only for printing Use style sheets for what they do well – like fonts. Use tables for margins. Pages should be viewable without style sheet See browser compatibility table at: www.webreview.com/style/css1/charts/mastergrid.shtml

XSL New language designed to work with XML Can’t be used with HTML

Sources HTML Publishing on the Internet, 2nd edition by Brent Heslop and David Holzgang (The Coriolis Group, 1998) Webmonkey (Mulder’s Stylesheets Tutorial) http://hotwired.lycos.com/webmonkey/authoring/tutorials/tutorial1.html Sample Sheets from W3C – www.w3c.org/StyleSheets/Core/Overview Jeffrey Zeldman – www.zeldman.com Little Shop of CSS Horrors – www.haughey.com/csshorrors