Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cascading Style Sheets Scripting with Style. CSS versus HTML  Ways to format in HTML –HTML Tag extensions –Converting Text to images –Page Layout with.

Similar presentations


Presentation on theme: "Cascading Style Sheets Scripting with Style. CSS versus HTML  Ways to format in HTML –HTML Tag extensions –Converting Text to images –Page Layout with."— Presentation transcript:

1 Cascading Style Sheets Scripting with Style

2 CSS versus HTML  Ways to format in HTML –HTML Tag extensions –Converting Text to images –Page Layout with Tables

3 Content versus Design  HTML was originally written for content –H1 different in different browsers, but not a big deal at first

4 Why Use CSS Then?  CSS allows you to separate design from content

5 CSS History  CSS1 (1996)  CSS2 (1998)  IE 3-6 versus Netscape 4.7x, 6.x, and 7.x –IE3 = some, IE4 = CSS1, IE5.x = almost there for CSS1 –IE6 – works well, but still has proprietary items  Netscape –Not there yet, but some support. –7.x is close  Opera –CSS compliant

6 Style Types  Inline style  Embedded style  External style

7 Inline Style  Individual tag on an HTML document My Title

8 Embedded Style  Entire HTML document selector {attribute:value; attribute:value;}

9 Embedded Example h1, h2, h3 {color: red; font-family: sans-serif;} h4 {color:#0000FF; font-family: sans-serif;} A:LINK {font-family: Verdana; font-size:11pt; font- weight: bold; color: #336633; TEXT-decoration: none;}

10 External Style  Any number of HTML documents  Separate file

11 External Example <!-- body {font-family: verdana; color: #000000; text-align: left; background:#ffffff;} a:link {font-family: verdana; font-size:11pt; font-weight: bold; color: #336633; text-decoration: none;} a:visited {font-family: verdana; font-size:11pt; font-weight: bold; color: #660066; text-decoration: none;} -->

12 Why Cascading?  Style Precedence –Internal over embedded and external –Embedded over external –External –Unless specifically set by user, style will overcome most browser default settings.

13 Inheritance (still cascading)  Figure 7-10 (7.14)  Figure 7-13 (7.16)  Parents and Descendants  Contextual Selectors –li b{color:#00FF00}

14 Various Font and Text elements  Font Families (7.18)  Font Size (7.20)  Spacing (7.22)  Aligning text (7.25)  Much more in this section...

15 Backgrounds  Various color settings (7.30)  Background images (7.32)  Once again check browser displays

16 Hyperlinks  a: {text-decoration: none}  a: visited {}  a: link {}  a: active {}  a: hover {}

17 IDs (7.43)  pseudo-class  pseudo-elements  Hyperlinks are an example  Also have items like –p: first-letter{font-size:200%} –p: first-letter {text-transform: uppercase}  Cross-browser issues

18 Classes (7.43)  Way to create, define, and use elements In HTML document Here you go.

19 Class Example In stylesheet h3.special {color:#FFFF00; font-style: italic;} In HTML This is yellow italic. or... This is yellow italic.

20 DIV and SPAN tags  Block level text elements  Inline elements

21 Why use DIV or SPAN?  IE versus Netscape (7.47-7.49)  See HTML in Figure 7-55

22 CSS and DHTML  A large portion of programming that is taking hold, but browser specifications are making it difficult.

23 Let's Play  Let's work on a short CSS exercise –http://homepages.wmich.edu/~rea/380/exercises/css/ex2.htmhttp://homepages.wmich.edu/~rea/380/exercises/css/ex2.htm


Download ppt "Cascading Style Sheets Scripting with Style. CSS versus HTML  Ways to format in HTML –HTML Tag extensions –Converting Text to images –Page Layout with."

Similar presentations


Ads by Google