Results 1 to 25 of 45
-
01-19-2004, 06:26 AM #1Web Hosting Master
- Join Date
- Jan 2003
- Location
- Houston, TX - Originally from UK
- Posts
- 707
How to create a valid XHTML webpage
How to create a valid XHTML webpage
1. (Optional) Use an xml prologue:
Code:<?xml version="1.0" encoding="iso-8859-1"?>
2. Use a proper, valid DOCTYPE:
XHTML 1.0 Strict, Transitional, Frameset
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Code:<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Code:<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
Code:<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
6. Validate your pages against http://validator.w3.org.
And that's it!
Of course, this is only the beginning. By taking this first step you are opening yourself up to the wonderful world of designing with web standards, and can start to truly appreciate the amazing bandwidth savings you can achieve.
(Having said that it is perfectly possible to have a completely valid XHTML document that uses nested tables, spacer gifs and all the outdated junk markup HTML is littered with. But what would be the point of that, right?)
ps...To any XHTML purists out there, I know that if you use XHTML you should serve your document as application/xhtml+xml, but until there is a reliable way of doing this that doesn't give Internet Explorer the willies, I'll stick to the old-fashioned text/html. I know of one resource that may be of use, but haven't tried it. The url to the article is: http://keystonewebsites.com/articles/mime_type.php. If someone's tried it and fancies sharing their knowledge, please do!
-
01-19-2004, 06:08 PM #2Web Developer
- Join Date
- Feb 2003
- Location
- Connecticut
- Posts
- 5,460
I'd like to extend on 5, if I may:
5b: To all tags that don't close, you need to end them with a /, as seen in example 4. A list of common tags which use this are:
Code:<hr/> <img/> <link/> <meta/> <br/>
-
01-19-2004, 10:36 PM #3New Member
- Join Date
- Jan 2004
- Posts
- 1
Re: How to create a valid XHTML webpage
Originally posted by Zopester If someone's tried it and fancies sharing their knowledge, please do!
-
01-22-2004, 06:16 AM #4Web Hosting Master
- Join Date
- May 2002
- Location
- UK
- Posts
- 2,997
Originally posted by DanX
I'd like to extend on 5, if I may:
5b: To all tags that don't close, you need to end them with a /, as seen in example 4. A list of common tags which use this are:
Code:<hr/> <img/> <link/> <meta/> <br/>
Additionally you didn't mention that you need to enclose all attributes in quotes.
e.g. <a href="#" border="0" /> instead of <a href=# border=0 />
For attributes that don't have a value just repeat it e.g.
<input type="checkbox" checked /> becomes <input type="checkbox" checked="checked" />
-
01-22-2004, 02:48 PM #5Web Developer
- Join Date
- Feb 2003
- Location
- Connecticut
- Posts
- 5,460
Originally posted by Rich2k
For backwards compatibility you need to add a space before the / e.g. <br /> not <br/>
Additionally you didn't mention that you need to enclose all attributes in quotes.
e.g. <a href="#" border="0" /> instead of <a href=# border=0 />
For attributes that don't have a value just repeat it e.g.
<input type="checkbox" checked /> becomes <input type="checkbox" checked="checked" />
-
01-22-2004, 03:33 PM #6Web Hosting Master
- Join Date
- Jan 2003
- Location
- Houston, TX - Originally from UK
- Posts
- 707
Thanks for the additions guys! Amazing what you forget to put in when you do a how-to!
-
02-10-2004, 12:38 AM #7Newbie
- Join Date
- Feb 2004
- Posts
- 7
thanks, other than what you mentioned in this topic, is there much more of a difference between html+xhtml?
-
02-10-2004, 02:35 AM #8learning is in the doing
- Join Date
- Sep 2000
- Location
- Alberta, Canada
- Posts
- 3,146
XHTML is to get one out of the bad habits we learned with HTML.
Gets us ready to code properly for when we move to XML as well. Which is why I found it strange to use the DTD mentioned in #1 for XHTML -- that DTD is for XML whereas this thread is supposed to be about XHTML.
I been using the 'application/xhtml+xml' directive for awhile now, but only with our index page. This is to prove to our Clients that want to use it, it is available. XHTML was fairly easy to get used to and much easier than learning to code using CSS for positioning, as opposed to Tables. Using Tables to position Content is one of those bad habits I mentioned.
Although I recommend everyone to switch to XHTML, starting with Transitional and staying with it for awhile will make using XML that much easier. IE is slowing up the change to XML though so you'll have lots of time to get good at both, XHTML Transitional & Strict.Last edited by Website Rob; 02-10-2004 at 02:38 AM.
• PotentProducts.com - for all your Hosting needs
• Helping people Host, Create and Maintain their Web Site
• ServerAdmin Services also available
-
02-13-2004, 12:00 AM #9WHT Addict
- Join Date
- Aug 2002
- Location
- California
- Posts
- 110
I read somewhere that it is recommended to use <div> tags instead of using nested tables for laying out the webpage. I really find <div>s difficult to understand.
Can someone point me to the tutorial or more information regarding this?
-
02-14-2004, 01:05 PM #10Web Hosting Master
- Join Date
- Jan 2003
- Location
- Houston, TX - Originally from UK
- Posts
- 707
Originally Posted by Website Rob
-
03-06-2004, 03:06 AM #11Junior Guru Wannabe
- Join Date
- Feb 2004
- Location
- India
- Posts
- 48
Hi,
Useful thread.
Thanks.
-Devil
-
05-01-2004, 10:47 AM #12Newbie
- Join Date
- Mar 2004
- Posts
- 27
Just wondering...can older browser read XML? If you use XML do you have to use XSLT? I suppose XML won't go together with CSS?? I'm not a real pro in XML...just beginning to learn about it.
-
05-06-2004, 02:22 AM #13Registered User
- Join Date
- May 2004
- Location
- New Zealand
- Posts
- 357
Nice work Zopester.
-
05-10-2004, 06:22 AM #14Web Hosting Master
- Join Date
- May 2002
- Location
- UK
- Posts
- 2,997
Originally posted by webwhiz
Just wondering...can older browser read XML? If you use XML do you have to use XSLT? I suppose XML won't go together with CSS?? I'm not a real pro in XML...just beginning to learn about it.
XSLT is simply another subset of XML.
Usually XSLT is used to take a pure data XML file and take a presentation layer of XSL and produce a final file combining the data and presentation together.
XHTML is a subset of XML for HTML presentation but following XML rules.
In XML all tags must be closed, this is why we have <br /> instead of <br> in XHTML. You can use <br/> without the space before the / and it will work in most browsers. However so that older browser can understand it we put the space in before the / (as web browsers have always been great at ignoring tags and attributes that they don't understand).
XHTML and CSS are designed to work together. CSS in XML doesn't mean anything unless you clarify what subset of XML you mean. The only one it make sense in is XHTML.
Confused yet?
In reality to see one web page there could be as many as 4 XML documents powering a single page
1) An XML file returned from a database
2) XML file gets converted to a website specific XML format
3) XSL file contains the presentation layer to display the XML data file
4) XSL and XML files processed to generate an XHTML file
It can get even more confusing if you start throwing SOAP and Web Services into the equation!
-
06-30-2004, 10:38 AM #15Newbie
- Join Date
- Jun 2004
- Posts
- 7
Nice work Zopester.
-
08-04-2004, 03:30 PM #16Newbie
- Join Date
- Aug 2004
- Posts
- 15
Good work Zopester. Very useful information.
-
08-30-2004, 04:45 AM #17WHT Addict
- Join Date
- Oct 2002
- Location
- Central America
- Posts
- 163
Originally posted by DWS
I read somewhere that it is recommended to use <div> tags instead of using nested tables for laying out the webpage. I really find <div>s difficult to understand.
Can someone point me to the tutorial or more information regarding this?Design. Programming. Hosting. Did I mentioned Design?
www.webbasica.com
-
05-06-2005, 08:15 PM #18Newbie
- Join Date
- May 2005
- Posts
- 13
It took me one entire day to validate my first page ever but once you get it it i worth is and you save time and space and the speed is increased for your future designs! I recommend to eveyone to learn who to code XHTML /CSS, learn DIV layout being even better
*¨) ¤ BHS-D¤
.·´ .·*¨) .·*·. *
(¸.·´¸.·*¸ ¤ www.bhsdesign.com¤
-
12-05-2005, 05:57 PM #19Newbie
- Join Date
- Dec 2005
- Posts
- 11
Reading the title of this topic I was about to post the validator.w3.org website but it seems you were one step ahead. Great advice on validating XHTML webpages
-
01-04-2007, 12:10 AM #20Junior Guru
- Join Date
- Nov 2005
- Posts
- 188
I'm trying to make my forums valid. If I get this
... <body> <script language="JavaScript"> <!--
how do I find out where it is at and what is wrong with it?
-
01-05-2007, 05:42 AM #21Junior Guru Wannabe
- Join Date
- Jul 2005
- Posts
- 60
language="JavaScript" has been depreciated. Use this instead:
<script type="text/javascript">
-
01-09-2007, 01:47 AM #22Newbie
- Join Date
- Jun 2003
- Posts
- 14
thanks!!! for the input it's very helpful
-
01-18-2008, 04:45 AM #23Newbie
- Join Date
- Jan 2008
- Posts
- 10
Good place to start learning xhtml. Thanks.
-
02-14-2008, 03:24 PM #24Newbie
- Join Date
- Aug 2005
- Posts
- 10
Nice, but what's the difference between the doctypes?
-
02-23-2008, 11:29 PM #25Junior Guru Wannabe
- Join Date
- Feb 2008
- Posts
- 39
nice work. interesting.