Download presentation
Presentation is loading. Please wait.
Published byChester Rodney Tucker Modified over 9 years ago
1
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages
2
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 CSS2
3
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 CSS3
4
XP Creating and Using Classes New Perspectives on Blended HTML, XHTML, and CSS4 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
5
XP Creating and Using Classes New Perspectives on Blended HTML, XHTML, and CSS5 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; }
6
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 CSS6
7
XP Creating External Styles New Perspectives on Blended HTML, XHTML, and CSS7 ID selectors are more specific than class selectors (whether dependent or independent) Element selectors (also known as type selectors), are the least specific
8
XP Linking an HTML File to an External Style Sheet New Perspectives on Blended HTML, XHTML, and CSS8 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
9
XP Linking an HTML File to an External Style Sheet New Perspectives on Blended HTML, XHTML, and CSS9
10
XP Creating the External Style Sheet Code New Perspectives on Blended HTML, XHTML, and CSS10 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
11
XP Using the Text Properties New Perspectives on Blended HTML, XHTML, and CSS11
12
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 CSS12
13
XP Using the Text Properties New Perspectives on Blended HTML, XHTML, and CSS13 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
14
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 CSS14
15
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 CSS15
16
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 CSS16
17
XP Creating Pseudo-Elements New Perspectives on Blended HTML, XHTML, and CSS17 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
18
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 CSS18
19
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 CSS19
20
XP Creating Pseudo-Elements The cascade determines which style prevails based upon its source or location New Perspectives on Blended HTML, XHTML, and CSS20
21
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 CSS21
22
XP Using Filters New Perspectives on Blended HTML, XHTML, and CSS22
23
XP Using Filters New Perspectives on Blended HTML, XHTML, and CSS23
24
XP Working With an Independent Class New Perspectives on Blended HTML, XHTML, and CSS24
25
XP Working With an ID Selector New Perspectives on Blended HTML, XHTML, and CSS25
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.