1 / 14

Introduction to XHTML

Introduction to XHTML. XHTML stands for E X tensible H yper T ext M arkup L anguage XHTML is aimed to replace HTML XHTML is almost identical to HTML 4.01 XHTML is a stricter and cleaner version of HTML XHTML is HTML defined as an XML application. What Is XHTML?.

thyra
Download Presentation

Introduction to XHTML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to XHTML

  2. XHTML stands for EXtensible HyperText Markup Language XHTML is aimed to replace HTML XHTML is almost identical to HTML 4.01 XHTML is a stricter and cleaner version of HTML XHTML is HTML defined as an XML application What Is XHTML?

  3. XHTML is a combination of HTML and XML (EXtensible Markup Language). XHTML consists of all the elements in HTML 4.01 combined with the syntax of XML. The following HTML code will work fine if you view it in a browser, even if it does not follow the HTML rules: <html> <head> <title>This is bad HTML</title> <body> <h1>Bad HTML </body> XHTML - Why?

  4. The Most Important Differences: XHTML elements must be properly nested XHTML documents must be well-formed Tag names must be in lowercase All XHTML elements must be closed Differences Between XHTML And HTML

  5. Elements Must Be Properly Nested <b><i>This text is bold and italic</i></b> • Documents Must Be Well-formed <html> <head> ... </head> <body> ... </body> </html> • Tag Names Must Be In Lower Case <body><p>This is a paragraph</p></body>

  6. All XHTML Elements Must Be Closed Non-empty elements must have an end tag. <p>This is a paragraph</p> Empty Elements Must Also Be Closed Empty elements must either have an end tag or the start tag must end with />. Example: <br /> <hr /> // for drawing horizontal line <img src="happy.gif" alt="Happy face" />

  7. XHTML Syntax Some More XHTML Syntax Rules: • Attribute names must be in lower case • Attribute values must be quoted • Attribute minimization is forbidden • The id attribute replaces the name attribute • The XHTML DTD defines mandatory elements

  8. Attribute names must be inlower case <table width=100%> <img src= “ URL” width=200 height=300> Attribute Minimization Is Forbidden <input checked="checked" /> <option selected="selected" /> <frame noresize="noresize" /> The id Attribute Replaces The name Attribute <img src="picture.gif" id="picture1" />

  9. Mandatory XHTML Elements <!DOCTYPE Doctype goes here> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title goes here</title> </head> <body>Body text goes here</body> </html> The DOCTYPE declaration is not a part of the XHTML document itself. It is not an XHTML element, and it should not have a closing tag.

  10. XHTML DTD • The XHTML standard defines three Document Type Definitions. • The most common is the XHTML Transitional. An XHTML document consists of three main parts: • the DOCTYPE • the Head • the Body

  11. XHTML document types There are currently 3 XHTML document types: • STRICT • TRANSITIONAL • FRAMESET

  12. XHTML 1.0 Strict <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" http://www.w3.org/TR/xhtml1/DTD/ xhtml1-strict.dtd"> Use this when you want really clean markup, free of presentational clutter. Use this together with CSS.

  13. XHTML 1.0 Transitional <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN’’ "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-transitional.dtd"> Use this when you need to take advantage of HTML's presentational features and when you want to support browsers that don't understand Cascading Style Sheets.

  14. XHTML 1.0 Frameset <!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN""http://www.w3.org/TR/xhtm l1/DTD/xhtml1-frameset.dtd"> Use this when you want to use HTML Frames to partition the browser window into two or more frames.

More Related