foundation of web application developmnet - xhtml

30
XHTML Foundation of Web Application Development - Part 1 Vashira Ravipanich www.vashira.com 1 Tuesday, February 3, 2009

Upload: vashira-ravipanich

Post on 18-Jan-2015

7.116 views

Category:

Technology


2 download

DESCRIPTION

My first presentation of the "Foundation of Web Application Development" series, which I used in in-house training. Hope it useful for the others.

TRANSCRIPT

Page 2: Foundation of Web Application Developmnet - XHTML

Road Map

• Build it! : XHTML

• Paint it! : CSS

• Make it fly! : JavaScript

• Hook with data! : Server Side Scripts

2Tuesday, February 3, 2009

Page 3: Foundation of Web Application Developmnet - XHTML

Road Map

• Build it! : XHTML

• Paint it! : CSS

• Make it fly! : JavaScript

• Hook with data! : Server-Side Scripts

We are here

3Tuesday, February 3, 2009

Page 4: Foundation of Web Application Developmnet - XHTML

Let’s build the web

• Build web pages is not a difficult thing

• Just HTML and some styles

• Plenty of tools around

• Dreamweaver

• Even Visual Studio

• The problem is...

4Tuesday, February 3, 2009

Page 5: Foundation of Web Application Developmnet - XHTML

Let’s build the web• You can’t master what you don’t really know

• Most WYSIWYG editors produce JUNK tags in your works

• Even worst

• They usually insert massive in-line styles

• They mess up with structure layout

• They help, but not teach

• Back to basic - be Zen!

5Tuesday, February 3, 2009

Page 6: Foundation of Web Application Developmnet - XHTML

Let’s build the web

Any Text editor would be more than enough!

6Tuesday, February 3, 2009

Page 7: Foundation of Web Application Developmnet - XHTML

Web Taxonomy

• Hyperlinks

• URL = Uniform Resource Locator

• HTTP = HyperText Transfer Protocol

• Browser = HTML reader/interpreter

where is it?

How to get it?

Display it

7Tuesday, February 3, 2009

Page 8: Foundation of Web Application Developmnet - XHTML

HTML

• What is HTML?

• Stands for HyperText Markup Language

• If you ever write a blog post, you probably familiar with HTML already

• Current stable version is HTML 4

8Tuesday, February 3, 2009

Page 9: Foundation of Web Application Developmnet - XHTML

HTML markup

• Elements

• Attributes

• <element-name attribute=”value”>content</element-name>

• Tags - <p>, <ul>, <li>, <b>, <i>, <input>

• and a lot more...

9Tuesday, February 3, 2009

Page 10: Foundation of Web Application Developmnet - XHTML

Sample<html>

<head> <title>Hello HTML</title>

</head> <body>

<p>Hello World!!</p> </body>

</html>

10Tuesday, February 3, 2009

Page 11: Foundation of Web Application Developmnet - XHTML

Block or Inline?

• All elements belongs to either Block or Inline

• Block - p, div, table

• Inline - span, b/strong, i/em, u, img, a

• Block CANNOT be inside Inline

• <em><p>content</p></em>

11Tuesday, February 3, 2009

Page 12: Foundation of Web Application Developmnet - XHTML

Common Attributes

• Core Attributes

• i18n Attributes

• Event AttributesInternationalization

Count characters between i and n

12Tuesday, February 3, 2009

Page 13: Foundation of Web Application Developmnet - XHTML

Core Attributes

• id - unique identifier

• class - assign type

• title - add more information, show tooltip

• style - inject inline style

Used by screen reader

13Tuesday, February 3, 2009

Page 14: Foundation of Web Application Developmnet - XHTML

i18n Attributes

• dir - content direction ltr, trl

• xml:lang - en, de

Just forget it!

14Tuesday, February 3, 2009

Page 15: Foundation of Web Application Developmnet - XHTML

Event Attributes

• onclick

• ondbclick

• onmouseoever

• onmouseout

• onkeypress

• etc...

15Tuesday, February 3, 2009

Page 16: Foundation of Web Application Developmnet - XHTML

Text Elements

• paragraph - p

• line break - br

• emphasis - i/em

• head - h

• Two br IS NOT p

• Avoid i and b - using em and strong

16Tuesday, February 3, 2009

Page 17: Foundation of Web Application Developmnet - XHTML

Semantic HTML Please...

• Two br IS NOT p

• Look like start a new paragraph

• What about the meaning?

• Avoid i and b - using em and strong

• Look similar

• What about the meaning?

• The problem is accessibility

17Tuesday, February 3, 2009

Page 18: Foundation of Web Application Developmnet - XHTML

XHTML

• eXtensible HTML

• Combination of XML and HTML

• Tags from HTML

• Rule from XML

18Tuesday, February 3, 2009

Page 19: Foundation of Web Application Developmnet - XHTML

Why XHTML?

• We are living in 2009

• Industry standards

• Cross browsers support

• Validated

19Tuesday, February 3, 2009

Page 20: Foundation of Web Application Developmnet - XHTML

XHTML structure

• One root element per document

• Properly nested elements

• Close elements

• Lowercase elements

20Tuesday, February 3, 2009

Page 21: Foundation of Web Application Developmnet - XHTML

Properly nested elements

<p>this<strong>is<em></strong>wrong</em></p>

<p>this<strong>is<strong><em>right</em></p>

Bad Good

21Tuesday, February 3, 2009

Page 22: Foundation of Web Application Developmnet - XHTML

Closed elements

<p>paragraph1<p>paragraph2<br><hr><img src=”icon.png”>

<p>paragraph1</p><p>paragraph2</p><br /><hr /><img scr=”icon.png” />

Bad Good

22Tuesday, February 3, 2009

Page 23: Foundation of Web Application Developmnet - XHTML

Lowercase elements

<P> paragraph3 <Img Src=”icon.png”/></p>

<p> paragraph3 <img src=”icon.png”/></p>

Bad Good

23Tuesday, February 3, 2009

Page 24: Foundation of Web Application Developmnet - XHTML

More Syntax

<table WIDTH=100%> <tr> <td>col1</td> </tr></table>

<input checked><option selected></option>

<table width=”100%”> <tr> <td>col1</td> </tr></table>

<input checked=”checked”><option selected=”selected”></option>

Bad Good

24Tuesday, February 3, 2009

Page 25: Foundation of Web Application Developmnet - XHTML

Sample<!DOCTYPE - html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html><head> <title>Hello HTML</title>

</head> <body>

<p>Hello World!!</p> </body>

</html>

What does it means?

25Tuesday, February 3, 2009

Page 26: Foundation of Web Application Developmnet - XHTML

Document Type Declaration

• Drive how browser render this document

• Beware - if not declare your document may run in Quirks mode

• XHTML 1.0 Transitionaland your life will be in

trouble!

26Tuesday, February 3, 2009

Page 27: Foundation of Web Application Developmnet - XHTML

Need to know more?

• There are plenty of (X)HTML tutorials over the internet. Go and read some!

• Just Googling “XHTML”

• For me, wikipedia is a good place to get started

• W3Schools is a good reference when you forget some tags

as I always do :)

27Tuesday, February 3, 2009

Page 28: Foundation of Web Application Developmnet - XHTML

Need to know more?Read these useful books

28Tuesday, February 3, 2009

Page 29: Foundation of Web Application Developmnet - XHTML

Foundation of Web Application Development Series

• Part 1 - XHTML

• Part 2 - CSS

• Part 3 - JavaScript

• Part 4 - Server-Side Scripts

Others are coming soon!

29Tuesday, February 3, 2009

Page 30: Foundation of Web Application Developmnet - XHTML

http://www.vashira.commore presentations available in

30Tuesday, February 3, 2009