Sunday, November 18, 2012

Answers > How Does a Web Designer Defines a Page as XHTML as Opposed to HTML?

How Does a Web Designer Defines a Page as XHTML as Opposed to HTML?

by nForms on October 14, 2012

This is not for school. Just something i was thinking about.

Tags: , , , , ,

Similar XForms | XML Posts

{ 4 comments… read them below or add one }

Oo,oo, Pick Me! June 29, 2011 at 9:39 am

Must use the correct DocType and code your pages to XHTML 1.0 Standards. For the correct DocTypes:

http://www.w3.org/QA/2002/04/valid-dtd-list.html

Look under "HTML 1.0 – Strict, Transitional, Frameset". Same extension used: *.html/*.htm

Ron

MrAnswer June 29, 2011 at 9:39 am

just save the file with .xhtml extencion this makes able the use of other web systems and codes.

Pervalicious June 29, 2011 at 9:39 am

You have to define the doctype for the page. There’s 3 types: strict, transitional and frameset. Transitional is the most popular. You need to add this code to the top of your page:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html

PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml&quot; xml:lang="en" lang="en">

if you want 1 of the other 2 types check the link below

joe.attaboy June 29, 2011 at 9:39 am

The top answer is wrong. There is no ".xhtml" extension. XHTML files use the "html" or "htm" extension, just like the rest.

The differences are in the DOCTYPE as the second responder stated. There are also other requirements for valid XHTML that must be followed. XHTML is a derivative of HTML that is XML comlpliant.

All tags must be written in lower-case. In XHTML Strict (one of the DOCTYPES), the page will not render properly if upper-case tags are used.

All tags must either have a closing tag, or in the case of single tags such as "br" ir "img", the single tag must be closed with a space and a backslash just in front of the final angle bracket (like this: "<br />"

A number of HTML tags have been depreciated and are no longer valid.

The page can have some old-style HTML if the DOCTYPE is "transitional." However, developers are encouraged to create even transitional pages to strict standards.

Previous post:

Next post: