Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.

Similar presentations


Presentation on theme: "INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages."— Presentation transcript:

1 INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages

2 XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Use classes to style several tags Identify the differences between dependent and independent classes Apply classes to text Use external style sheets to format several pages Create a spread heading Position text to the left, center, or right

3 XP Objectives Identify text attributes to avoid Use the CSS pseudo-elements :first-letter and :first-line Identify CSS filters Use the tag Apply special effects to text using CSS filters Create and apply an independent class New Perspectives on Blended HTML, XHTML, and CSS3

4 XP Creating and Using Classes Dependent classes are declarations that let you style the same tag several ways Apply the style by coding the word class followed by an equal sign and the name of the class just to the right (and within) the element selector itself: Unplug the appliance before making any repairs. New Perspectives on Blended HTML, XHTML, and CSS4

5 XP Creating and Using Classes Independent classes are declarations that let you style any tag several ways An independent class selector is preceded by the period flag character, like this:.center { New Perspectives on Blended HTML, XHTML, and CSS5

6 XP Creating and Using Classes New Perspectives on Blended HTML, XHTML, and CSS6 You then code the declarations, just as you would for any other style:.center { color: white; background-color: navy; text-align: center; } Using the class in your code is called applying a style

7 XP Creating and Using Classes New Perspectives on Blended HTML, XHTML, and CSS7 use ID selectors for formatting a single particular instance on a Web page where you want to style an element Code an ID in the same way you code an independent class, except that instead of using the period as the flag character, you use the pound symbol ( # ) #copyright { font-variant: small-caps; }

8 XP Creating External Styles Inline styles: Override both embedded and external styles Embedded styles: Override external styles External styles: Do not override either embedded or inline styles New Perspectives on Blended HTML, XHTML, and CSS8

9 XP Creating External Styles New Perspectives on Blended HTML, XHTML, and CSS9 ID selectors are more specific than class selectors (whether dependent or independent) Element selectors (also known as type selectors), are the least specific

10 XP Linking an HTML File to an External Style Sheet New Perspectives on Blended HTML, XHTML, and CSS10 Rel stands for relationship – The rel attribute value is always stylesheet Href stands for hypertext reference – The href attribute value is the name of the CSS file to which you are linking The type attribute value is always text/css

11 XP Linking an HTML File to an External Style Sheet New Perspectives on Blended HTML, XHTML, and CSS11

12 XP Creating the External Style Sheet Code New Perspectives on Blended HTML, XHTML, and CSS12 An external style sheet document does not have any HTML code External style sheets usually begin with a comment that identifies the style sheet, such as its purpose, the author, the date last revised, and so forth

13 XP Using the Text Properties New Perspectives on Blended HTML, XHTML, and CSS13

14 XP Creating the External Style Sheet Code Setting your own values in the body element overrides any browser default values New Perspectives on Blended HTML, XHTML, and CSS14

15 XP Using the Text Properties New Perspectives on Blended HTML, XHTML, and CSS15 Add white space between letters and words – Use the letter-spacing property to control the amount of white space between letters. – Use the word-spacing property to create white space between words

16 XP Using the Text Properties The text-align property takes the following values: – left (the default) – center – right – Justify Indenting text p { text-indent: 2em; } blockquote {text-indent: 7%; } New Perspectives on Blended HTML, XHTML, and CSS16

17 XP Using the Text Properties Margin properties control white space – margin-top: – margin-right: – margin-bottom: – margin-left: Hanging indent – the first line of a paragraph is at the left edge of the window and the remaining lines of the paragraph are indented from the left edge of the window New Perspectives on Blended HTML, XHTML, and CSS17

18 XP Using the Text Properties Change case h3 { text-transform: capitalize; } Text decoration – underline – overline – line-through – blink New Perspectives on Blended HTML, XHTML, and CSS18

19 XP Creating Pseudo-Elements New Perspectives on Blended HTML, XHTML, and CSS19 The pseudo-elements create an element selector where none existed before The colon you see before the element names is required and is part of the pseudo-element name Both the :first-letter and :first-line pseudo- elements work only with block-level elements

20 XP Creating Pseudo-Elements Limit your styles to the following properties: – the font properties – the color and background-color properties – the margin, padding, and border properties – the text-transform, font-variant, and line-height properties New Perspectives on Blended HTML, XHTML, and CSS20

21 XP Creating Pseudo-Elements The :first-letter pseudo-element is used to create a drop cap (aka initial cap) The :first-line pseudo- element formats just the first line of a paragraph New Perspectives on Blended HTML, XHTML, and CSS21

22 XP Creating Pseudo-Elements The cascade determines which style prevails based upon its source or location New Perspectives on Blended HTML, XHTML, and CSS22

23 XP Using Filters Proprietary code functions on only one hardware or software platform, such as Internet Explorer or Firefox Both have developed proprietary code that can add special effects to text, known as filters. New Perspectives on Blended HTML, XHTML, and CSS23

24 XP Using Filters New Perspectives on Blended HTML, XHTML, and CSS24

25 XP Using Filters New Perspectives on Blended HTML, XHTML, and CSS25

26 XP Working With an Independent Class New Perspectives on Blended HTML, XHTML, and CSS26

27 XP Working With an ID Selector New Perspectives on Blended HTML, XHTML, and CSS27


Download ppt "INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages."

Similar presentations


Ads by Google