Dreamweaver applies an XHTML doctype. The requirements of the XHTML Validator determine what is flagged as an error.
First: XHTML Validator vs. JavaScript
The greatest number of “error flags” on your page are coming from the JavaScript used by your menus. These are probably not real errors, but the XHTML validator thinks they are.
If you comment out the JavaScript menu code so the XHTML Validator cannot see it, the error count drops from 32 to 8 errors. This does not hide the JavaScript from the menus. It only hides it from the XHTML Validator.
<script type="text/javascript">
<!--//--><![CDATA[//><!-- //ADD this line of Comment Marks
function MM_preloadImages() { //v3.0
. . . .
}
//--><!]]> //ADD this line of Comment Marks
</script>
Second: Required attributes
Your menus use 4 foreground images. Foreground images are expected to include the alt=" " attribute so some text will be visible if the image is missing or the user has images turned off.
ADD an alt=" "
attribute to each of the 4 tags in the menu. (Add text to describe the menu item; eg: alt="contact"
, alt="galleries"
, etc.)
That will reduce the error count from 8 to 4.
– one example – alt=“home” is the last attribute in the <img>
tag. –
<td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','images/html-images/home-4.jpg',1)"><img src="images/html-images/home-3.jpg" width="235" height="52" id="home" alt="home" /></a></td>
Third: Improper HTML
Beneath the menu is an empty <table>
tag. It should never have existed. Delete this line.
That will reduce the error count from 4 to 3.
<table width="940" border="0" cellpadding="0" cellspacing="1"></table>
Fourth: Required attributes
The <textarea>
tag expects two required attributes (in the same way that <img>
tags expect the alt=
attribute). The rows=" "
attribute is expected to have a value as shown in this example.
Add cols="16"
and rows="4"
to the <textarea>
tag and the error count drops from 3 to 1.
'<textarea name="Comments" id="Comments2" cols="16" rows="4"></textarea>'
Fifth: Deprecated attributes
The height="94"
attribute in this <table>
tag (around the <textarea>
field) is deprecated and should be replaced with CSS. For the time being, just delete it.
That reduces the error count to zero, but several warnings appear.
<td height="99" colspan="2"><table width="280" height="94" border="0">
Sixth: Warnings
The four <label>
tags are empty and therefore flagged as warnings. Had the form been constructed differently they would not be empty.
Change the nested tables by copying the text in the first <td>
tag into the empty <label>
tag. Then replace the text in the first <td>
tag with the entire <label>
tag and its text. Like this:
<tr>
<td colspan="2">
<table width="281" border="0">
<tr>
<td width="107" align="left" valign="middle" class="heb"><label for="name">שם מלא:</label></td>
<td width="162" height="62"><input type="text" name="name" id="name" /></td>
</tr>
</table>
</td>
</tr>
The following attachment contains these changes. It validates clean. The CSS is unchanged.
By example, the simple answer your question is: CSS does not make invalid HTML valid. Improper HTML, examples of which are shown above, make HTML invalid. CSS styles the appearance of the page. Once the HTML is sound, use CSS to make the page look the way you want it to look.
Cleaning up the HTML a bit more by moving attributes to CSS and adding CSS styles to customize the look of the page would be the next step in the development of the page.
attachment:
contact2-20150119a.html (6.6 KB)