[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

W3C error

I've updated my site to html5 from XHTML 1.0 Transitional, and some code which previously validated is now triggering an error.  The error is:
"The img element with the ismap attribute set must have an a ancestor with the href attribute."  In the previous version of this page, this code was enveloped as CData, which allowed it to validate.  For some reason, when checking under html5, W3C rejects the CData tag as a "bogus comment."

Here is the code which caused the error:

<![CDATA[
<center></center><map name="FrontPageMap">
<area shape="rect" coords="310,96,580,120" href="mailto:stay@mauitradewinds.com"></map>
<p class="hiddenText">]]>
<img id="logo1" ismap="ismap" usemap="#FrontPageMap" src="images/logo1.png" alt="" class="scalable">

 Please advise how to satisfy the "ancestor href" requirement, or how to apply CData in html5 so that it will validate.
0
ddantes
Asked:
ddantes
1 Solution
 
Scott Fell, EE MVEDeveloperCommented:
Frontpage is the main problem...

You just need to recreate your image map.  http://www.w3schools.com/tags/tag_map.asp
<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
  <area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
  <area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>

Open in new window


You may not need a map and just use
<a href="mailto:stay@mauitradewinds.com">
   <img id="logo1"  src="images/logo1.png" alt="" class="scalable">
</a>

Open in new window

0
 
ddantesAuthor Commented:
That really worked.  I do want to map the link -- I prefer that to having the entire image be a link.  Thank you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now