1 WDMD 170 – UW Stevens Point WDMD 170 Internet Languages eLesson: CSS Introduction to Style Sheets (NON-audio version) © Dr. David C. Gibbs 2003-04.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

1 Cascading Style Sheets™ (CSS) Outline 5.1 Introduction 5.2 Inline Styles 5.3 Embedded Style Sheets 5.4 Conflicting Styles 5.5 Linking External Style.
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.
It’s All About Style The Basics of Style Sheets Presented by Barry Diehl.
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.
Chapter 8 Creating Style Sheets.
XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Cascading Style Sheet (CSS) Instructor: Dr. Fang (Daisy) Tang
4.01 Cascading Style Sheets
Computing Concepts: CSS. Aims  To understand the uses of css  To understand the different types of css  To be able to create a css file  To be able.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
HIGHER COMPUTING CSS. WHAT IS CSS? CSS: Cascaded Style Sheets used to separate a web site’s content(information) from its style(how it looks).
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Cascading Style Sheets Dreamweaver. Styles Determine how the HTML code will display Determine how the HTML code will display Gives designers much more.
HTML - Quiz #2 Attendance CODE:
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
HTML & CSS.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Today’s objectives  Complete web page  Using xhtml & CSS  Adding CSS to documents Embed url(File);  CSS.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Just A Few More Fun Objectives 1 Having Some Fun With Java Script 2 Using Style Sheets.
Working with Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 5.
CO1552 – Web Application Development Cascading Style Sheets.
CSS CSS is short for C ascading S tyle S heets. It is a new web page layout method that has been added to HTML to give web developers more control over.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Cascading Style Sheets Class 2, Lecture 2 Rachel A Ober
Stylin’ with CSS Monday October 8 th and Tuesday October 9 th.
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: HTML/XHTML Tables (NON-audio version) © Dr. David C. Gibbs
Cascading Style Sheets Creating a Uniform Site. Style Sheets  Style sheets are used for conformity on a web page or web site.  Style sheets eliminate.
Cascading Style Sheets
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Cascading Style Sheets CSS. Source W3Schools
XHTML Formatting font with a style declaration. Formatting Font HTML uses the font tag to change size and family of font But… the font tag is being deprecated.
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
Introduction to CSS. What is CSS? CSS ("Cascading Style Sheets") determines how the elements in our XHTML documents are displayed and formatted. By using.
Cascading Style Sheets
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
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.
Style Sheets. Coding Style Sheets  Style sheets use RULES to create the style  A selector (a tag or user-defined style name)  and then declarations.
CSS Cascading Style Sheets *referenced from
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
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 Development & Design Foundations with XHTML
4.01 Cascading Style Sheets
Introduction to CSS.
Madam Hazwani binti Rahmat
CX Introduction to Web Programming
Website Design 3
Introduction to CSS.
Introduction to Cascading Style Sheets (CSS)
Introduction to CSS.
4.01 Cascading Style Sheets
Presentation transcript:

1 WDMD 170 – UW Stevens Point WDMD 170 Internet Languages eLesson: CSS Introduction to Style Sheets (NON-audio version) © Dr. David C. Gibbs

2 WDMD 170 – UW Stevens Point Objectives Recognize the purpose for using style sheets. Identify the three methods for using styles in an HTML document. Create inline, embedded, and external styles. Understand the “cascade” in CSS.

3 WDMD 170 – UW Stevens Point WHY use Style Sheets? Allow web authors to separate structure from content –Structure – provided by descriptive “rules” dictated by the styles Layout Design –Content – provided by the HTML document Increases consistency between various pages of a website Allows you to reduce typing –Using one style sheet for multiple pages –Specifying information once rather than for each instance of an object Increases the versatility of web pages

4 WDMD 170 – UW Stevens Point Three methods of supplying styles Inline: adding style where it is needed. Embedded: in a … block in the section. External: in a separate file.

5 WDMD 170 – UW Stevens Point CSS Terminology Selector: The element you have decided to modify Property: Names a characteristic of a selector Value: Describes how you want to modify a particular property Declaration: a combination of a property and a value Syntax h1{color: blue;} selectorpropertyvalue declaration

6 WDMD 170 – UW Stevens Point Methods of using CSS in your pages inline style Heading 1 using an inline style embedded style external style sheet

7 WDMD 170 – UW Stevens Point CSS: Inline method Styles are added within an HTML tag here is some regular text without style regular text in 20 pt h1 text in 30 pt Verdana – inline style. Code sample: inlineCSS.htminlineCSS.txt inlineCSS.htminlineCSS.txt

8 WDMD 170 – UW Stevens Point CSS: Inline method First, a paragraph is defined without style (line 5). A paragraph is defined in which the font-size is specified in “points” (line 6). Text within the h1 header is defined with an altered font-size, a color, and a different typeface (line 7). The color name works as well here is some regular text without style 6. regular text in 20 pt 7. h1 text in 30 pt Verdana – inline style

9 WDMD 170 – UW Stevens Point CSS: Inline method Styles apply only within the delimiting tags. Quotes are used because it’s HTML: attrib=“value” style=“ ”. Multiple styles concatenated using a semicolon “;”. regular text in 20 pt h1 text in 30 pt Verdana – inline style.

10 WDMD 170 – UW Stevens Point eTask 1: Inline styles 1.Create an HTML document using inline styles. 2.Use the tag, the tag, and any other appropriate tags to illustrate inline styles. 3.Write the document so it explains and demonstrates how inline styles work. 4.Save your document as InlineStyles.htm in your CSS_I folder (that’s “css roman numeral one” folder).

11 WDMD 170 – UW Stevens Point Styles are added within the … tag in the section of the HTML document h1 {color: green} em {background-color: red; color: white} p {font-size: 18pt}.blue {color: #0000FF} Embedded Styles CSS: Embedded method Code sample: embeddedCSS.htmembeddedCSS.txt embeddedCSS.htmembeddedCSS.txt

12 WDMD 170 – UW Stevens Point CSS: Embedded method Styles have been added within the … tag Heading (using h1 and its default size) Heading (using h1 with blue "class") paragraph text (within the paragraph tag - 18 pt) more paragraph text but making use of the blue class more Text in italics, making use of em more Text italic text again Code sample: embeddedCSS.htmembeddedCSS.txt embeddedCSS.htmembeddedCSS.txt

13 WDMD 170 – UW Stevens Point eTask 2: Embedded styles 1.Create an HTML document using embedded styles. 2.Use (minimally) the tag, the tag, and any other appropriate tags to illustrate embedded styles. 3.Write the document so it explains and demonstrates how embedded styles work. 4.Save your document as EmbeddedStyles.htm in your CSS_I folder.

14 WDMD 170 – UW Stevens Point CSS: External method Styles are written in a file saved with a.css extension FILENAME: external.CSS h1 {font-family: Arial} a {text-decoration:none} a:hover{text-decoration:underline; color:red; background- color: #CCFFCC} li em {color:red; font-weight: bold} ul {margin-left: 2cm} ul ul {text-decoration: line-through; margin-left:.5cm} NOTE: This file must be somehow “included” by the document!

15 WDMD 170 – UW Stevens Point CSS: External method External Styles Shopping list for Monday Milk 10. Bread Pita bread 13. Black bread 14. French baguettes Rice 18. Potatoes 19. Pizza with pepperoni Order here Code sample: externalCSS.htm externalCSS.txt externalCSS.htmexternalCSS.txt

16 WDMD 170 – UW Stevens Point CSS: External method Code sample: externalCSS.htm externalCSS.txt externalCSS.htmexternalCSS.txt Lots of questions emerge from this style sheet! See how many you can track down! 1.Why is the header in Arial font? 2.Why are some list items displayed as “strikeout” while others are not? 3.How did “with pepperoni” get red while “Monday” did not? 4.“Order here” is actually a link (view the page and try it). a.Where did the underline go? b.“Hover” over the text and watch what happens!

17 WDMD 170 – UW Stevens Point eTask 3: External styles 1.Create an HTML document that makes use of external styles. 2.Use the tag, the tag, and any other appropriate tags to illustrate external styles. 3.Write the document so it explains and demonstrates how external styles work. 4.Save your document as ExternalStyles.htm in your CSS_I folder.

18 WDMD 170 – UW Stevens Point The “Cascade” A set of rules which determines the order in which multiple style sheets are applied to an HTML document. In other words, which style prevails if inline, embedded, and external styles all exist for a specific selector?

19 WDMD 170 – UW Stevens Point Cascading Order Which style will be used when there is more than one style specified for an HTML selector? The simplest answer is given by “proximity”; the style closer to the selector is used. From these options, browser default external style sheet internal style sheet (inside the tag) inline style (inside HTML element) … an inline style (inside an HTML element) has the highest priority, which means that it will override every style declared inside the tag, in an external style sheet, and in a browser (a default value).

20 WDMD 170 – UW Stevens Point Cascading Order You can demonstrate the cascade by using all three methods in the same document, impacting the same selector. In fact, examine the use of in the three examples given in this eLesson. [Print or view each of inlineCSS.htm, embeddedCSS.htm, and externalCSS.htm so you can see each of their uses.]inlineCSS.htmembeddedCSS.htmexternalCSS.htm If you use all three in the same document, you can see how the priorities are established.

21 WDMD 170 – UW Stevens Point Assignment: Cascading styles 1.Create an HTML document making use of all three methods: inline, embedded, and external styles. 2.The tag is a good choice to demonstrate the “cascade”, and you may copy in the styles from this eLesson. 3.The content of the document should describe how the “cascade” works. 4.Save your document as cascadeExample.htm in your CSS_I folder.

22 WDMD 170 – UW Stevens Point Assignment: Implement an external style sheet in your e-Folio. 1.Add a very simple external style sheet to the index file of your e-Folio. 2.For example, a.Create myStyleSht.CSS, containing the linemyStyleSht.CSS body {font-family: verdana} b.Add these lines to the of your index.htm file: c.Make sure the css file is in the same directory as your index.htm file. 3. This should display your document in a new font!

23 WDMD 170 – UW Stevens Point Summary Styles may be applied –Inline –Embedded –External The “cascade” of styles can be determined by proximity to the selector.

24 WDMD 170 – UW Stevens Point End of eLesson Jump to the Beginning of this eLesson WDMD 170 Course Schedule D2L Courseware Site