Thursday, October 28, 2004

XHTML FAQ. <img> tag disappears!!!

(Preguntas frecuentes de XHTML. La etiqueta <img> desaparece!!!)

As I can read into this FAQ (Same FAQ in Spanish), provided by the W3C(World Wide Web Consortium) many things about relationships between HTML and XHTML 1.0, why migrate to XHTML, which user agent support it, which mime type you must use, but also I have seen something that I'm surprised that img tag disappears!!! in XHTML 2.0.

The title of the section is Is <img> being replaced by in XHTML?, and the reason is very reasonable. All images are equivalent to some piece of content; If XHTML 2.0 allows you to put a src attribute on any element at all, this says that if the image is available, and the browser can process it, use it, otherwise use the content of the element. For example:

<p src="map.png"><span src="map.gif">Exit from station...</span></p>

Although it is better to use content negotiation if your server supports it (and most do):

<p src="map">Exit from station...</p>

Which would negotiate with the browser which sort of image it accepts, and give the browser its preferred sort. If there is no available image, then the content of the element would be used. This has an added advantage that you can later add other image types on your server and you don't have to change the page for it still to work.

One more thing: Other killed. The term browser, which should be replaced, in most cases by user agent. Just read Why do you say "user agent" everywhere, instead of "browser"?



Permalink: XHTML FAQ. <img> tag disappears!!! 

0 Comments:

Post a Comment

<< Home