Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web-based Application Development Lecture 5 January 24, 2006 Anita Raja.

Similar presentations


Presentation on theme: "Web-based Application Development Lecture 5 January 24, 2006 Anita Raja."— Presentation transcript:

1 Web-based Application Development Lecture 5 January 24, 2006 Anita Raja

2 Agenda Cascading Style Sheets PTW Chapter 3 Attributes, Lists, and Tables PTW Chapter 4

3 Programming the Web using XHTML and JavaScript Chapter 3 Cascading Style Sheets

4 I’ll bet red headings would look nice

5 Internal Style Sheets Redefines the presentation rule (style) for certain elements “Internal” because contained within the HTML source document itself Styles may be defined using different style sheet languages so … … the language used must be specified

6 Internal Style Sheets element in section … The style sheet instructions in this element are: Written in plain text format Using the cascading style sheet language

7 Internal Style Sheets Also specify default style sheet language for entire HTML document: elements go in the section

8

9 Internal Style Sheets h2 { color:red } Style definition Name of tag Property Value

10 Internal Style Sheets h2 { color:#D61130 }

11 Internal Style Sheets Alignment Options are: left, center, right, justify h2 {color:red; text-align:center}

12 Uh, oh. I need bigger section headings

13 Formatting Fonts Using Styles Could find & replace all with Why not? What if some had been used for other things?

14 Formatting Fonts Using Styles Use font-size property: h2 {color:red; text-align:center; font-size:24pt}

15 Formatting Fonts Using Styles Other choices for font-size value: 150% smaller small, x-small, xx-small larger large, x-large, xx-large

16 Formatting Fonts Using Styles Use font-style property: h2 {… font-style:italic …}

17 Also normal, oblique

18 Formatting Fonts Using Styles Other properties text-decoration underline, overline, line-through, blink, none text-transform capitalize, uppercase, lowercase, none font-variant small-caps, none background-color transparent, one of the color names or numbers

19 Formatting Fonts Using Styles Paragraph styles Only works for content enclosed within elements p {font-size:14pt}

20 Formatting Fonts Using Styles Indent and line spacing: p {text-indent:25pt; line-height:24pt} p {text-indent:12%; line-height:150%}

21 Formatting Fonts Using Styles Font Families What if not installed on user’s browser? p {font-family:”Lucida”}

22 Formatting Fonts Using Styles Include more than one font families: p {font-family:”Lucida”,”Arial”}

23 Formatting Fonts Using Styles Warning: multiple fonts may not have the impact you intend User’s display may not include the fonts you specified Common fonts may be the best choice overall

24 Formatting Fonts Using Styles Can compress definition p {font-style:italic; font-weight:500; font-variant:small-caps; font-size:14pt; line-height:24pt; font-family:”Lucida”,”Arial”} p {font: italic 500 small-caps 14pt/24pt ”Lucida”,”Arial”}

25 Do all paragraphs have to be the same?

26 Tags with Multiple Styles The same type of element can have multiple definitions called “classes” p {text-align:justify; font-weight:bold} p.intro {text-align:center; color:red}

27 Tags with Multiple Styles The p.intro class includes the styles of the p class but changes those styles How is this class invoked? Explains why “none” is an option text-transform; font-variant …

28 Local Styles Local styles take precedence over other style definitions The text in this paragraph will The text in this paragraph won’t be red

29 No existing tag is quite right. Now what?

30 Custom Tags Can create entirely new elements Generic tags: (block level) (inline)

31 Custom Tags span {font-size:18pt} Let me make something perfectly clear.

32 Custom Tags Classes may be defined for custom tags span.red {color:red}

33 I’m going to get tired of entering style definitions into all my web pages.

34 External Style Sheets Text-only file Contains style definitions only h2 {color:red} h1 {font-size:24pt p {text-align:center} p.small {font-size:10pt} No tags needed

35 External Style Sheets Save in a file with a.css extension css = cascading style sheets Local, internal and external may be present in the same document Local overrides internal Internal overrides external

36 External Style Sheets How to specify external style sheets? Add tag in section

37 External Style Sheets Problem: older versions of browsers might not recognize style definitions Could use comments: <!-- p {text-indent:25pt; line-height:24pt} -->

38 External Style Sheets MORE problems: XHTML may not recognize this use of comments Solution: use method If older version of browser does not recognize this tag it will ignore it

39 Assignment Debugging Exercise, p. 81 Correct errors Post corrected document to your Web space as “Lagerstrom-Ch-3.html” Grade based on: Appearance Technical correctness of code

40 Chapter 4 Attributes, Lists, and Tables Programming the Web using XHTML and JavaScript

41 Extensions and Deprecations Extensions – features not found in “standard” HTML Too often, NN’s extensions don’t work in IE and vice versa Therefore, be careful about non-standard features Official features listed at www.w3c.orgwww.w3c.org

42 Extensions and Deprecations Deprecation – feature being phased out May work in older browser versions but eventually will cease to be supported Obsolete – features that are not supported by browsers in strict compliance with W3C standards

43 Extensions and Deprecations At www.w3c.org …www.w3c.org Site Index H HTML 4.01 Specification A. Changes 3.1 Deprecated Elements

44 Extensions and Deprecations Forms of XHTML (see p. 85) Strict Does not recognize deprecated elements Transitional Which should you use? Transitional Otherwise older browsers won’t display your pages well

45 Extensions and Deprecations vs. is deprecated isn’t Which would be preferable for making changes to an entire document?

46 Tags and Attributes Styles have properties h2 {text-align:center} Attributes have values … No quotation marks Quotation marks

47 Tags and Attributes size= “1” to “7” (smallest to largest) color= “red”, “blue”, etc. face= “Arial”, “Courier”, etc.

48 Tags and Attributes Alignment = “left”, “center”, “right” Using tags: Centering this text is centered

49 Tags and Attributes Preferred method using styles: h2 {text-align:center} p {text-align:center}

50 Tags and Attributes Background colors tag bgcolor and text attributes Using tags:

51 Tags and Attributes Using styles in the body: body {background-color:yellow; color:blue}

52 Tags and Attributes Horizontal rules Using tags: Using styles: hr {height:7px; width:75%; background-color:red} Ch04-Ex-01

53 Next Class HW 2 due 2 debugging assignments Complete Chapter 4 PTW Chapter 2 WWG


Download ppt "Web-based Application Development Lecture 5 January 24, 2006 Anita Raja."

Similar presentations


Ads by Google