Re: XHTML 2 - Which way should I insert images and other media? wrote:
> Hi,
> These code samples show how you could include an image in a XHTML 2 
> document:
> <object src="logo.png" type="image/png"><h1>W3C</h1></object>

In this case, the <object> element is unnecessary, as shown by your next 
example.  However, object should be used, for example, when there is no 
other element with the right semantics for the job or the content 
requires the use of <param> elements.

> <h1 src="logo.png" type="image/png">W3C</h1>

If the logo is indeed a form of content, as it appears to be in the case 
with the W3C logo, then this would probably be best.

> And with the help of CSS3, you could also do this:
> h1 { content: url(logo.png), contents; }
> <h1>W3C</h1>

That markup and CSS is more suited to situations where the image is a 
purely presentational rendering of the content.  For example, if you 
were just replacing the heading with the image to achieve the desired 
font, colours or some other presentational aspect, then this would be 

Of course, some people may have different, yet completely valid opinions 
and reach a different conclusion than I.  So, the markup you choose 
needs to be determined on a case by case basis, there is no 
one-size-fits-all solution.

Lachlan Hunt    Rediscover the Web   Igniting the Web

Received on Friday, 24 December 2004 02:35:22 UTC