Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

webpage not validating properly...

Status
Not open for further replies.
It's only an issue if your custom elements and attributes don't work the way they're supposed to work.

Also, the <script language="JavaScript"> should be <script type="text/javascript">.

All elements and attributes in XHTML are lowercase. You have "onChange" and "onKeyUp" events when they should be "onchange" and "onkeyup".

The "height" attribute only applies to TD and TH elements when working with tables, not TR elements.

To use backgrounds, you have to use CSS. There is no background attribute in Strict XHTML.

All elements must be closed properly. If an element is "empty" like BR or INPUT, it must be closed like <br /> or <input/>, not <br> or <input>.

Lastly, there is no "absmiddle" value for the "align" attribute of the IMG element. Try using "middle".
 
Is this an issue?
Valid (X)HTML syntax is a subset of the syntax that is understood by most current browsers. If you have invalid elements or attributes in your markup that work nonetheless, you may consider it not to be an issue.

However, going forward, there's no guarantee that those elements will continue to be supported, nor can you be sure that they are supported on browsers with which you have not been able to test - have you tried your site on Mac browsers?

That being the case, it makes sense to conform to the standard wherever possible. After a while it becomes second nature.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thanks guys.

I'll try to get this thing validating properly.
 
quick question...should I even be using xhtml?
 
skwurl said:
quick question...should I even be using xhtml?
That depends on how adamant you are regarding future compatibility with browsers that will inevitably be upgraded. HTML will probably be around for at least another decade. XHTML and CSS are here to stay, though they will change drastically (take a look at the XHTML2 and CSS3 stuff that are in the works ;-)). This time, you might change to HTML. It had fewer errors. :)
 
HTML will probably be around for at least another decade.
And the rest. We may live to see the demise of HTML, personally I doubt it. So long as your code is valid, I really don't think it's all that important whether its HTML or XHTML, particularly since the most commonly used browser will render everything as HTML anyway.

When the browsers have caught up with exploiting the advantages of XHTML, it'll be the time to totally advocate its use. For now, go with what you like best.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
You can use some of the rules from XHTML to form a kind of "personal best practice" technique to help you (and others after you) to migrate and maintain code into the future. I have chosen the following to guide my markup (regardless of whether I am coding for HTML or XHTML)...

- use only lower case for all my tag names
- always close a tag that I have opened (or add a / to the end of the tag that doesn't have a natural close tag, like hr, br, input, img)
- avoid using any style properties inline (move them to a style sheet)
- always use a doctype

They are fairly simple, and purely a personal guide. I have similar "rules of thumb" for server-side code, for javascript and for css. If nothing else it means it's easier to transform into something else later on (because I've stuck to a consistent style).

Anyway, that's my 1p on the subject.

Cheers,
Jeff

NB: In New Zealand they dropped the 1cent and 2cent coin years ago... and they are now planning to drop the 5cent coin. So if you are ever posting from NZ your input will be worth 10cents! Current exchange rates would mean that a NZ post is worth more than that of any other country! [smile]

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
The trailing slash, or "/", for empty elements is not valid for HTML according to the W3C validator. However, it gets you into the habit, so migrating XHTML (when necessary) is less of a pain.

Here's a rule I tend to follow:
- when using colors for the BODY, set them for the HTML element too (the canvas in XHTML is the HTML element, not the BODY element)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top