Forum Moderators: open

Message Too Old, No Replies

Correcting errors for validation

First and biggest problem

         

D_Blackwell

8:12 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Taking a deep breath I have submitted two of my larger sites for validation. I'll mete out the problems that have arisen and perhaps as I get a handle on the the first couple I will grasp enough to see my way through the rest.

The DTD is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

On one site I have two areas of navigation where the same error is repeated again and again. In one I have a two column directory in which I want each individual box to be clickable as opposed to just some of the text within the box.

<div id="leftcol">
<a href="dead-end.html">
<div class="directory">
Pamela Baker
<br />
<p class="update">
Not Located
</div>
</a>
etc.

I've used a div class to set my box and linked the whole box. This is repeated throughout the directory.

It will be a similar fix for the other section most likely where I've linked around <p>

<div id="links">
<a href="directory.html">
<p class="links">
Our Directory
</p>
</a>
etc.

The validator says that the document type does not allow element "DIV" (or "P") here; missing one of "Applet", "Object", "Map", "Iframe", "Button" start-tag.

I tried several of these with horrendous consequences.

What to do?

MWpro

8:23 pm on Jul 24, 2003 (gmt 0)

10+ Year Member




<div id="links">
<a href="directory.html">
<p class="links">
Our Directory
</p>
</a>

Make sure you end that div tag.

Also, why are you using a <p> tag? You can just apply the class to the <a> tag like so


<a class="links" href="directory.html">

or you don't even have to put that class thing in at all. Just use something like this.


div#links a {
/*whatever is in .links put here/*
}

That says that every <a> tag inside of <div id="links"> will get those properties.

g1smd

9:45 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



(simplified): <a> <p> </p> </a> is not valid code. Wrong nesting.

At the very least change it to <p> <a> </a> </p> which is valid code.

The <br /> is XHTML code. Delete the ending / as your DOCTYPE says you are writing HTML 4.01 code not XHTML code.