Physics
Physics Prefix Physics SI Units Physics Constants Physics Symbols Physics Formula Physics Greek Physics Radiation Physics Spectrum Physics Converting
Electricity
Electric Resistance Electric Plug (UK) Electric Trailers
Mathematics
Maths Formula
Chemistry
Chem. Elements Chem. Ionic Chem. Organic
Geogra./Geology
Geography Geology Eras Geology Moh
Meteology
Weather
Shipping
Ship Compass Ship Knots Ship Morse Code
Web Programming
Web Buttons Web Are U human Web Hit Counters Web JavaScript Web XHTML
 
Pembrokeshire
Milford Haven
Haverfordwest
Weston-s-Mare
 
Home Page
Contact Site
DigitalDan email address scroller
Hit Counter 50
©2000-2012 DigitalDan.co.uk
DigitalDan.eu
XHTML

 
HTML was the main language used to develop websites, however, most new commercial sites are developed in a new version of the language called XHTML. Fortunately, all the popular browsers will continue to support HTML for the foreseeable future and XHTML is so similar to the old HTML that most old browsers will read the code without realising that the language has changed.
 
If you can already program HTML, you should be able to master XHTML fairly quickly because most of the tags (e.g. "<a href=....", "<p>", "<li>") are identical in both languages, provided you note the special rules below.
 
The "minor" differences between HTML and XHTML are designed to force programmers to develop tidy code. HTML forgives several programming errors e.g. <b>bold text with no end of bold.
This causes problems e.g. when a code contains errors, the different browsers will correct the problems using various methods and web-pages change when viewed on alternative browsers. Some of the features in HTML encouragred inefficient programming and these are no longer available in XHTML. (Many features of the <table> command are missing because the writers of XHTML suggest that style sheets would be more efficient.
 
There are two versions of XHTML which novices are likely to encounter (the third, called frameset is a specialised version). Strict requires everything in xhtml to be perfect and will not tolerate any deviation from the langauge. Transitional will allow many of the minor deviations often seen in code converted from html.
 
These are some of the differences between HTML and XHTML that could be encountered by a novice. There are many others but this sample will allow you to overcome most compatibility issues.
HTMLXHTML
Rarely has a doctype but if present it will be similar to this and appear as the very first line of code (before <html>)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Must have a "doctype" line.
If you are using the Strict version of XHTML, copy this line, exactly as written, and insert it into your code, it must go on the first line (before <html>) (This is a copy and paste task, don't worry about what the line means
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1-strict.dtd">
 
If you are using the Transitional version of XHTML, copy this line, exactly as written, and insert it into your code, it must go on the first line (before <html>) (This is a copy and paste task, don't worry about what the line means
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
 
All tags including <html> <li> <img src=... and <div> can be written in either capital letters or lower case The use of capital letters within tags (except the doctype) is forbidden. You must always use lower case. e.g. <div>The Div tag;</ div> is correct but XHTML will not allow <DIV>The DIV tag</ DIV>
If you have an opening tag e.g. <div> and forget to include a the closing tag </ div<>, HTML will try to guess what you wanted and may be able to display the page correctly All tags that are opened must be closed within the code. If you have an opening tag e.g. <div> and forget to include a the closing tag </ div>, XHTML will reject the code, displaying an error message if your settings permit the display of errors.
Some tags including <br;> do not have a corresponsing closing tag. They normally appear on their own All tags must have a closing tag, otherwise they would be unusable due to the above rule. Fortunately, all the new closing tags can be made by putting "/ " after the initial < sign. Therefore the closing tag for <br> is </ br>
An opening tag can be used without a closing tag, this reduces the need for combined opening and closing tags. If an opening tag is immediately followed by a closing tag e.g. <br></ br> there is an abbreviation for the combined opening and closing tag. Abbreviations are formed by taking the openning tag and putting a "/" immediately before the final > Here are some examples
<br></ br> becomes <br /> and <img src="star.gif" alt="star"></ img> becomes <img src="star.gif" alt="star" />
<img.... tags do not have to have an alt= attribute
(A good programmer should always include one but HTML will not force you to include it.)
All <img... tags must include an alt= attribute. XHTML will reject <img="star.gif" /> It will not be accepted unless the alt= attribute is present <img="star.gif" alt="star" / >
All attributes are supposed to have their values within quote markes e.g. alt="star" but HTML will tollerate missing quotes e.g. alt=star XHTML will insist on every attribute having the correct quote marks. alt=star is not allowed but alt="star" will be ok.
There are many clever features incorporated into the <table> and <font> structures. Tables can be used for page presentation and you often see nested tables The language design tries to encourage <table> to be reserved for organised lists of data. Many of HTML's advanced table and font features are missing. The use of stylesheets with their advanced presentation features are encouraged as alternatives to these tags.
DigitalDan.Eu is part of the DigitalDan.co.uk group