Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

jobs.webdeveloper.com

e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


XHTML: What you need to know

by Marc Plotz

May 26, 2009

With everyone connecting in different ways your coding practices could be causing heartache for your users. We'll help you tackle this issue by showing what XHTML is and how it can help you reach your maximum audience.

Introduction

There are many pages on the internet that contain HTML that is either improperly formatted or just bad. These pages will render OK in most browsers. However, in certain situations they stand the chance of rendering incorrectly. Compound this with the limited rendering power of mobile and other hand-held devices and you stand a good chance of presenting a broken page to a large audience. To stop things like this from happening you can implement a good coding standard along with a strong code foundation that follows strict rules.

What is XHTML?

XHTML stands for eXtensible Hypertext Markup Language. Put simply, XHTML is HTML that implements the syntax rules of XML. XHTML is stricter, cleaner, and, in my own opinion, much more sensible than normal HTML.

What's more, XHTML is not difficult to get used to at all. Once you start applying the rules in your code you will notice just how simple it is to present good markup. Lets take a look at the implications.

The Groundwork

XHTML is built on a very solid foundation that requires certain strict rules to be permanently enforced.

These rules are:

  • Every page must have a Document Type Definition.
  • Every page must have exactly one root element.
  • All elements must always be typed out in lower case.
  • All elements must be properly nested.
  • All elements must be closed.
  • Attributes may not be minimized.
  • The id attribute replaces the name attribute.

Let us now look at these in more detail.

Every page must have a Document Type Definition.

There are generally three different dtd's that you can use on your web pages:

  1. Strict: Use this DOCTYPE for clean, clear markup and use it with CSS
  2. Transitional: Use this DOCTYPE when you are still going to use some of HTML's presentational features along with CSS
  3. Frameset: Use this DOCTYPE when you intend to use frames on your site

Examples:

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

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

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

XHTML: What you need to know
Every page must have exactly one root element


Up to => Home / Authoring / Tutorials / Python




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers