My code is this <div class="content"><img title="Its free of charge" usemap="Map4" alt="Free consulttant" src="/example/themes/andreas09/img2/expert-consultant.gif"/> <map id="Map4" name="Map4"><area alt="Ask now" href="http://support.example.com/index.php?act=tickets&code=open" coords="86,115,144,139" shape="rect"/> </map></div> Code (markup): Its working but Unfortunately this is not valid XHTML 1.1. If someone can help me writing 1.1 Valid code, its very much appreciated thanks
What error code are you getting? Are you aware that xhtml1.1 must be served as application/xhtml+xml or other flavor of xml? IE does not support true xhtml. Do you not have visitors who use IE? If you want to use xml syntax, code against xhtml1.0, as it may be served as text/html. cheers, gary
Besides what Gary said (your MIME-type won't match up), your main errors should be: using "name" on stuff. "Name" was brought to HTML4 for scripting purposes. XHTML however must comply as if it were an XML document. While XHTML1.0 tolerates "name", the decision was to go to "id" in place of name. Second, there's an & sitting in the href. & is a special character. XML does not know how to parse it because it is NOT a valid character in XML (therefore XHTML1 and 2). To keep the &, you need to change it to & amp; (without the spacing, which I added because all browsers will see that and change it to look like just &, which is why it will still work as a link). There are only 5 character entities you may use, and one is almost never used because it's not HTML friendly but is a pure XML thing (& apos; without spaces is that one). You may only use & gt; & lt; & amp; and & quot; Third, that's all the potential errors, but I find image maps to be a bitch for surfing with images off or from a linear browser (like a text browser, or a screen reader), so I've always avoided them anyway in favour of CSS fake image maps. The only advantage I can think of for a real image map is when there's something horribly chunky-strange in shape and you need hundreds of funky coordinates to get the clickable area to fit the shape. Even then, you can fake it 90% of the time. I faked it pretty well on this map of the world. The continents aren't square, though the clickable areas are. Underneath all the CSS and the image is a simple, easy-to-use list. Just a ul. http://stommepoes.jobva.nl/Menus/maphover.html (As you can see, the only part to give anyone trouble is if they try to click on Turkey which I've made part of Europe, but it makes Asia highlight. The idea is that most people are going to simply click on a continent and usually near the middle because that's what humans do, and the highlighting tells them beforehand what they're about to click.) As an example. Or you can show us what this thing is supposed to look like and function and I'll bet we can do a clean-code version. I didn't see too many coords on your map-- looks like a perfect candidate for an anchor turned into a block of clickable area to me : )
Which with what gary said - WHY XHTML 1.1 in the first place? Cross browser support is spotty, XML apps are overcomplicating the matter and a general headache - it's not even worth the effort. ESPECIALLY if you want to use deprecated tags and sloppy coding techniques that have accessability issues. (which image maps qualify for on all counts)
Right, now switched to v1 its comfortable. If they continue depreciating tags, we will be coding plane pages
No, you will be coding structured, semantic html with css to control presentation and javascript to control behavior. That's a modular, scalable and maintainable approach to coding; the three areas orthogonal to one another with the DOM providing the intersect. cheers, gary
Ah, image maps aren't deprecated, they just suck. : ) Using one won't fux0r with the validator, just with some of your visitors.
They are in XHTML 1.1 - which is why the answer is don't use 1.1 Among all the other endless reasons that 1.1 isn't ready and is unlikely to BE ready for widespread use on internet sites for a decade or more - local intranet you can get away with it because you can dictate what browser your co-workers will use with your crapplet - internet? Hell no.