W3C home > Mailing lists > Public > www-style@w3.org > March 2001

RE: background width and height

From: Manos Batsis <m.batsis@bsnet.gr>
Date: Sat, 24 Mar 2001 12:30:16 +0200
Message-ID: <D1E4335E90D4D311A99400D0B709A123448B38@EMAIL_SRV>
To: "'www-style@w3.org'" <www-style@w3.org>

Actually, with css2 you can have multiple background images even on top of
each other (hey, if they are transparent :-)
Of course you can place anything on top of them, or even in between. Here's
a basic example:


<div style="width:100%;height:100%;position:relative;">
      <img src="yourImagePath.gif"  style="
	   width:100%;
	   height:100%;
	   position:absolute;
	   left:0px;
	   top:0px;
	   z-index:1;" 
	   alt="this is my background image"/>
	  <span style="
	   position:relative;
	   z-index:2400;
	   font-size:56;">
	   tgnfjkwsgnfjdslkgnjfdslkgnfjdsl
	  </span>
    </div>

You may find this code big, but in case you have more elements it would be a
good idea to use classes and just define the z-index inline.
Enjoy...

Manos




> -----Original Message-----
> From: Mjumbe Ukweli [mailto:mjumbewu@hotmail.com]
> Sent: Saturday, March 24, 2001 9:28 AM
> To: www-style@w3.org
> Subject: Re: background width and height
> 
> 
> i don't want to use the workaround of putting the image in an 
> absolutely 
> positioned div because then, unless i put the rest of the 
> page's content in 
> another div, the image will cever the text.  it's not very 
> complicated, just 
> more so than it has to be.  and if i put the image in each 
> file then every 
> time i want to change it to a different image i would have to 
> go back into 
> each file and change them all, as opposed to changing a single 
> background-image in a stylesheet.
> 
> also, it's the principle of it all.  the principality.  why 
> use the new 
> standards if you still have to do workarounds?
> 
>                                                   &#8226; 
> mjumbe &#8226;
> 
> ----Original Message Follows----
> From: "Madison M" <rllrgrrl@hotmail.com>
> To: www-style@w3.org
> Subject: Re: background width and height
> Date: Sat, 24 Mar 2001 16:57:34 +1100
> 
> I don't recall seeing anyway to set the size of a background 
> image. But
> you could achieve what you want by putting the background 
> image as a regular 
> image into a div (so you could put it behind your other stuff) and 
> stretching it as you would a normal image.
> 
> Maddy
> 
> ______________________________________________________________
> ___________
> Get Your Private, Free E-mail from MSN Hotmail at 
> http://www.hotmail.com.
> 
Received on Saturday, 24 March 2001 05:30:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:08 GMT