Welcome to WebHeadStart.org

Web Technologies

Sponsored By

WebHeadStart.org is currently in beta.
Please pardon our appearance as we work to provide you with the most comprehensive reference on today's web technologies.

Interested in advertising on WebHeadStart? Become an advertising partner today!

[WWW-HTML Mailing List Archive Home] [Messages By Thread] [Messages By Date]

Re: XHTML 2 - Which way should I insert images and other media?

From: Lachlan Hunt <lachlan.hunt@iinet.net.au>
Date: Fri, 24 Dec 2004 13:35:14 +1100
Message-ID: <41CB8062.9020505@iinet.net.au>
To: teklund@gargile.net
CC: W3C HTML List <www-html@w3.org>

teklund@gargile.net 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 
appropriate.

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
http://lachy.id.au/ 
http://GetFirefox.com/     Rediscover the Web
http://SpreadFirefox.com/    Igniting the Web
Received on Friday, 24 December 2004 02:35:22 GMT
Valid XHTML 1.0! Valid CSS! Site Map | Privacy Policy | Terms of Use | WebHeadStart.org © 2005 All Rights Reserved.