/    Sign up×
Community /Pin to ProfileBookmark

Validating my HTML

I am trying to validate my HTML, however i am currently getting 133 errors:

[url]http://validator.w3.org/check?uri=http%3A%2F%2Fwww.dankellys.com%2F&charset=(detect+automatically)&doctype=Inline&group=0[/url]

i have noticed that alot of the errors are the DIVs i am using. I use the same div a number of times in one document (for example alot of the content is displayed in a div called “main_about”)

What is the best way to avoid these errors?

Cheers

Dan

to post a comment
CSS

12 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Jun 25.2008 — Id must be unique on the page. You seem to have multiple ids which is not allowed.
Copy linkTweet thisAlerts:
@WebJoelJun 25.2008 — An "ID" (such as [B]id="thisDiv"[/B]) can only be used once per-any page. It is "identification", unique to any individual (in the case, individual element "div").

A "CLASS" (such as [B]class="theseDivs"[/B]) is like a classroom, 'class', many. This can be re-used many times per-page. This reduces the size of the code as the 'class' is cached and re-used when encountered again.

The URL you provided is the W3C-Validator site, which of course shows the errors (although in this case, most of what I saw were actually 'warnings').

If you find & download the browser FIREFOX and then, get the self-installing extention "HTML-Validator by TIDY", you will have a powerful tool at your disposal: a 'one-click button' that CLEANS and corrects all "warnings" and present you with cleaned code.

TIDY will not correct bona~fide ERRORS as it might make things [I]worse[/I] for your page, but it expalins what is incorrect and offers suggestions for repiar.

Correcting the validational "warnings" almost never causes any harm or change to the page. Although many "warnings" in TIDY are in fact layout-busting events like improperly nested anchor links, missing end-tags, etc., often, correcting the 'warnings' is enough to repair a poorly-displaying page.
Copy linkTweet thisAlerts:
@dankellysauthorJun 25.2008 — cheers for that mate, ive changed all my id's to classes and it seems to have sorted alot of the errors. Another error i am having is with an embeded flash object, W3C doesnt seem to like:

[code=html]<embed src="images/work/work.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>[/code]

and also the <tr> tags in my table are returning errors?
Copy linkTweet thisAlerts:
@rpgfan3233Jun 25.2008 — Also:

There is no embed element. You need to use the object element with param elements instead.

All elements and attributes must be completely lowercase in XHTML. No uppercase is allowed because it is case-sensitive, unlike HTML. This alone will fix a few of your errors (e.g. IMG should be img, SCRIPT should be script, etc.)

There is no h7 element. Only h1-h6 exist.

The only possible elements that can be children of the table element are caption, col, colgroup, thead, tfoot, tbody or tr. An input element should be wrapped inside a td or th element, which should itself be wrapped in a tr element. This should fix more of your errors related to input and tr not being allowed, and your problem with a caption element being automatically inserted to compensate.

The textarea element has no height attribute. The rows attribute and/or CSS is used for this purpose.

It looks like there is a typo at the end of a textarea opening tag:
rows="4" height="150px" [color=red]w[/color]></textarea></td>[/quote]

The textarea element needs a cols attribute to denote the number of columns of text that can be entered.


That should take care of a lot of your errors.
Copy linkTweet thisAlerts:
@Declan1991Jun 25.2008 — As well as that, you should change your doctype to HTML. If your page is ever parsed as XHTML (which it won't be unless you send the appropriate headers with it), your JavaScript will break because it relies on things that don't exist in XHTML, the first I noticed was document.images.
Copy linkTweet thisAlerts:
@dankellysauthorJun 25.2008 — Thanks for all your help, my page is now XHTML valid! only about another 30 pages to get through... ?

Cheers

Dan
Copy linkTweet thisAlerts:
@Major_PayneJun 26.2008 — Also:

There is no embed element. You need to use the object element with param elements instead.[/QUOTE]
There is an embed tag (no closing tag used), but it is not recognized by the w3c.org and only a few browsers. The embed tag information can be insertED with JavaScript with the inherent problems that will arise for those who surf with JS turned off. Use of the noscripts tags would help with the usual warning. Page will validate even with the embed tag using JS.

Ron
Copy linkTweet thisAlerts:
@felgallJun 27.2008 — There is an embed tag (no closing tag used), but it is not recognized by the w3c.org and only a few browsers. The embed tag information can be insertED with JavaScript with the inherent problems that will arise for those who surf with JS turned off. Use of the noscripts tags would help with the usual warning. Page will validate even with the embed tag using JS.

Ron[/QUOTE]



That is because the <object> tag can do everything the <embed> tag can do and much more making the <embed> tag completely superfluous since there is never any situation where you need it. Also since not all browsers recognise the proprietary <embed> tag while they all do recognise the standard <object> tag using <embed> guarantees that it will only work in some of the browsers it would have worked in had you correctly coded it using <object> instead.
Copy linkTweet thisAlerts:
@Major_PayneJun 27.2008 — That is because the <object> tag can do everything the <embed> tag can do and much more making the <embed> tag completely superfluous since there is never any situation where you need it. Also since not all browsers recognise the proprietary <embed> tag while they all do recognise the standard <object> tag using <embed> guarantees that it will only work in some of the browsers it would have worked in had you correctly coded it using <object> instead.[/QUOTE]I use both tags so your statement is superfluous here. I just use javascript to make sure the page validates with the embed tag inserted via JS. I know how to properly code the object tag (satay method is one), but I've had some browser checks not work from the object tag.

Ron
Copy linkTweet thisAlerts:
@Declan1991Jun 27.2008 — Inserting something with JavaScript to make the page validate is only a work around. I doesn't mean that the page is valid anything.
Copy linkTweet thisAlerts:
@Major_PayneJun 27.2008 — Inserting something with JavaScript to make the page validate is only a work around. I doesn't mean that the page is valid anything.[/QUOTE]That's what you do to get your pages to validate when you may have to use a certain method. It IS STILL a validated page nontheless!

But your opion is just that...yours even as wrong as it may be.

I'm done with this topic and think it should be closed. I will no longer reply to comments... good or bad.

Ron
Copy linkTweet thisAlerts:
@WebJoelJun 27.2008 — thread closed
×

Success!

Help @dankellys spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...