Is <img> being replaced by <object> in XHTML2?

Answer Posted / guest

No. <img> is being replaced in XHTML2, but by something else
(although you could use <object> if you wanted).

The design of <img> has many problems in HTML:

It has no fallback possibilities, so that if you use an
image of type PNG for instance, and the browser can't handle
that type, the only alternative is to use the alt text. This
fact has hampered the adoption of PNG images, which in many
ways are better than GIF and JPG, since people have
continued to use the lowest-common denominator format, to
ensure that everyone can see the images.

The alt text cannot be marked up, so that if it gets used,
you just get the plain text.

It is possible to include a longdesc link to a description
of the image, to help people who cannot see, but it is
seldom implemented.

What XHTML2 does is say that all images are equivalent to
some piece of content; it does this by allowing you to put a
src attribute on any element at all. What this says is: if
the image is available, and the browser can process it, use
it, otherwise use the content of the element. For instance:

<p src="map.png">Exit from the station, turn left,

go straight on to <strong>High Street</strong>,

and turn right</p>

The advantage of this is that if the image is not available
for some reason (such as network failure) or the browser
can't render that sort of image, your document is still
usable. If you want to supply more than one sort of image,
you can do:

<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.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the status of the development of the html 5 standard?

409


How can I learn html?

429


What happens if you open the external CSS file in a browser?

582


Is it possible to change the color of the bullet?

458


Please anyone tell me , how to create toggle button without bootstrap.

916






What is a text tag?

468


How do you create links to sections within the same page?

476


What is the lifetime of local storage?

488


How do you add a template to html?

441


How to open a link in new tab or window?

566


Are there any advantages of grouping checkboxes in html?

451


How can we call the external style sheet in html for referring?

422


What is the difference between xhtml and html?

479


Who made html5?

439


What is ordered list?

443