[Javascript] Refresh an image, change an image

Chris T christ at saeweb.com
Fri Jun 11 15:15:38 CDT 2004


> For example:
> <style>
> body {background:url(mainpix.gif) no-repeat top right;}
> #overall
> {width:100%;height:100%;background:url(whateverelseitis.gif} no-repeat
> bottom right;}
> #overall img {width:100px;height:200px;position
> absolute;z-indez:-1;}
> </style>
>
>
> <div id="overall">
> <img src="whatever.jpg">
> <p>This statement would go over "whatever.jpg"</p>
> </div>

============================

And this would perform the same effect with one less element and 1 less
style declaration, no?

<style>
body {background:url(mainpix.gif) no-repeat top right;}
#overall{width:100px;height:200px;position
absolute;z-indez:-1;}
</style>

<img src="whatever.jpg">
<p id="overall">This statement would go over "whatever.jpg"</p>

Now if your point is that you can put a background in the DIV, of course
adding special functionality might entail changing how things are layed out
and how styles need to be use.

I think nesting elements inside of containers is strictly a preference. Not
a neccessity - unless the actual job calls for it. But if there's no need, I
don't see why anyone would want to add an extra element and style which adds
unneccessary HTML.

Chris Tifer




More information about the Javascript mailing list