HTML to xhtml - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

HTML to xhtml

Description:

'Name' attribute is deprecated. 10/1/09. Conversion HTML to xhtml ... 'Name' Attribute is deprecated. Name attribute used to identify some tag objects frame ... – PowerPoint PPT presentation

Number of Views:94
Avg rating:3.0/5.0
Slides: 17
Provided by: RSm68
Category:
Tags: html | deprecated | xhtml

less

Transcript and Presenter's Notes

Title: HTML to xhtml


1
HTML to xhtml
  • from old to new

Web Publishing
Randy Smith
2
What language should be used?
  • HyperText Markup Language as skeleton
  • Other embedded code or references
  • Scripts
  • Helper apps
  • References
  • Server extensions
  • Version of HTML
  • XML (eXtensible Markpup Language)
  • XHTML

3
What is different about xhtml?
  • HTML was designed to display data
  • W3C defined Extensible Markup Language (XML) to
    describe data
  • Documents and Document Type Definition (DTD)
  • Collection of XML declarations that defines the
    legal structure, elements, and attributes
    available
  • Content and Structure
  • HTML 4 is not XML compliant

4
XHTML simply refines HTML(and is intended to
replace)
  • A Reformulation of HTML 4 in XML 1.0
  • Almost identical to HTML 4.01, but is stricter
  • Use of Document Type Definitions
  • XML namespaces
  • Well-formed documents
  • Every element must be terminated
  • Containers must nest properly
  • All tags lowercase
  • Attribute values must be quoted
  • Name attribute is deprecated

5
Conversion HTML to xhtml
  • Begin with a declaration for XML version
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • XHTML documents must reference one of the three
    XHTML DTDs
  • Strict
  • Transitional
  • Frameset
  • First line of the HTML document must declare the
    compliance type (FrontPage is little help for
    this)

6
Strict XHTML compliance
  • lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Strict//EN" "http//www.w3.org/TR/xhtml1/DTD/xhtml
    1-strict.dtd"gt
  • Used when you're doing all of your formatting
    in Cascading Style Sheets (CSS). In other words,
    you aren't using ltfontgt and lttablegt tags to
    control how the browser displays your documents.

7
Transitional doctype declaration
  • lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "http//www.w3.org/TR/xhtml1/DT
    D/xhtml1-transitional.dtd"gt

Used when you need to use presentational
markup in your document. Most of us will be using
the transitional DTD for quite some time, because
we don't want to limit our audience to users with
browsers that support CSS.
8
Frameset declaration
  • lt!DOCTYPE html PUBLIC "-//W3C//DTDXHTML 1.0
    Frameset//EN" "http//www.w3.org/TR/xhtml1/DTD/xht
    ml1-frameset"gt
  • Used when your documents have frames

9
Root element must designate the XHTML 1.0
namespace
  • Root element of the document must be lthtmlgt and
    must designate the XHTML 1.0 namespace
  • Nothing before opening lthtmlgt tag (except the
    doctype declaration), and nothing after the
    closing lt/htmlgt tag
  • Include a new namespace attribute xmlns in the
    opening HTML tag.
  • lthtml xmlnshttp//www.w3.org/1999/xhtml
    xmllangen-US langengt

10
Well-formed documents
  • lthtmlgt
  • ltheadgt
  • lttitlegt
  • title must be present
  • lt/titlegt
  • ...
  • lt/headgt
  • ltbodygt
  • ...
  • lt/bodygt
  • lt/htmlgt

11
Every element must be terminated
  • All tags must be containers
  • lthtmlgt. . .lt/htmlgt
  • ltpgt. . .lt/pgt

12
Containers must nest properly
  • No containers may overlap
  • Technically illegal in HTML, most browsers will
    allow
  • ltpgtThis is ltbgtboldlt/pgtlt/bgt
  • Close tags in proper order
  • ltpgtThis is ltbgtboldlt/bgtlt/pgt

13
All tags must be lowercase
  • HTML allowed tags to be upper or lowercase
  • XHTML requires tags to be lowercase
  • Use a replace tool to ensure lowercase tags
  • MS FrontPage
  • Tools
  • Page Options
  • HTML Source
  • Tags are lowercase

14
All Attributes must be quoted
  • Most browser implementations allow attributes to
    work without quotes after the assignment
  • ltp aligncentergt
  • ltheight50gt
  • XHTML requires quotes
  • ltp aligncentergt
  • ltheight50gt

15
Name Attribute is deprecated
  • Name attribute used to identify some tag objects
  • ltframegt
  • ltiframegt
  • ltimggt
  • ltmapgt
  • Name replaced with id in XHTML
  • Some browsers do not support ID, so safer to
    use both
  • ltimg srclogo.gif idlogo namelogo ... /gt

16
Validate with a service
  • http//validator.w3.org/check/referer
  • http//validator.w3.org/file-upload.html
Write a Comment
User Comments (0)
About PowerShow.com