# Solved: Strict XHTML: IMG vs. OBJECT elements



## cristobal03 (Aug 5, 2005)

Hi all, this is my first post in the WebDev forum :up:

My boss resourced me to redesign our company website, and it's been forever since I authored a site so I'm catching up on the latest specs. I spent the last few days reading the W3C specification for HTML 4.01 as well as the spec for XHTML 1.0.

Now, my question is this: W3C says object elements like *IMG*, *IFRAME*, etc. may be going the way of the Dodo. However, scratching out a test index using IE 6 to browse seems to indicate iffy support of *OBJECT* as a replacement for *IMG*.

Here's the code I tossed together:


```
A random GIF image.
```
That gives me a blank page. If I intentionally break the object tag (by using an incorrect MIME type, for example) the alternate content does display. Also, if I assign the element's *height* and *width* attributes, the image will display in a scrollable frame.

What gives? Should I use *IMG*s instead? I'd prefer *OBJECT*s if it's possible.

Thanks for any tips/feedback.

chris.


----------



## php guy (Dec 17, 2004)

W3C says those objects may be going away in the future, but for now, I'd stick with the tag.

The main reason for this is that older browsers reading your page with for the image won't have a clue what to do with it, and since <img> is still supported by the current browsers, it's best to stick with the most compatable tag.


----------



## namenotfound (Apr 30, 2005)

Using to embed images are fine in FF and O, but tend to cause problems in IE (as I tested this out 2 years ago).

Stick with <img>

Also I'm pretty sure W3C mentions that for XHTML 2.0 which still have a long time before it comes out.
Where as, any element will be able to use "src" to embed images.

etc.

Supposely when XHTML 2.0 does come out, image.jpg will get better support in IE, but as it is right now using "data" it isn't supported well in IE.


----------



## cristobal03 (Aug 5, 2005)

Thanks guys :up:

chris.


----------

