You are here: Re: Making a <div display the equivalent of <img's alt= « HTML « IT news, forums, messages
Re: Making a <div display the equivalent of <img's alt=

Posted by Mark Simon on 12/18/05 07:54

I see you've found a solution, so if it does the job then it does the job.

> Anyone know of a way to make a div autosize to its
> background image? I realize that slows things down with the
> <img tag, that specifying size is the better route for
> stable-looking page load speed, but it would be nice to have
> the option.

I don't think you can without javascript (it's a trivial exercise in
Javascript). However, you really should use the width & height
attributes for the img tag, since that helps the browser to optimise
rendering the page. With information, you might as well as apply it (via
css) to the div.

> Well, now you went and lost me. Not hard to do, since I
> don't know what xslt is. I'll have a Google for it, but for
> now we're happy just to make this thing basically
> functional--we'll standardize the output to some
> specification on a later refactor of the code.

XML is a generalised markup language capable of marking up all sorts of
things. HTML has been re-formulated as a dialect of XML and the result
is known as XHTML.

XHTML is somewhat fussier than HTML (all tags must be in lower case, all
tags must be closed properly, even empty tags, etc), but otherwise
virtually identical. Browsers that render HTML (all of them) will
happily render XHTML, which is easier to interpret since they don't have
to bother with interpreting variations.

Any XML can be translated to any other XML using XSLT. XSLT Since XHTML
is also just a flavour of XML, it too can be translated to any other
XHTML. You can use this fact to, say, take some existing XHTML and
re-write it into more XHTML. For example, you could simply take your
images and wrap them inside divs with similar attributes.

This is assuming that your HTML completely follows XML structure, which
is what XHTML does.

Mark

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация