Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS: how to have 2 background images?

Status
Not open for further replies.

carpeliam

Programmer
Mar 17, 2000
990
US
i have two slices of an image that i want to have as a background image- one across the top, one on the side. i can't have two background rules for body... i was thinking that perhaps i could have divs with backgrounds, but those only apply to the content; meaning, if there's no content in the div, there's no background (and if only have a little content, i only get a little background). there has to be another way to do it?

Liam Morley
lmorley@wpi.edu
"light the deep, and bring silence to the world.
light the world, and bring depth to the silence."
 
Just add width and height to your divs:

<div style=&quot;width: 100%; height: 150px; background: url('background1.jpg');&quot;></div>
<div style=&quot;width: 120px; height: 100%; background: url('background2.jpg');&quot;></div>

for example.

Hope it helps.
 
hrm... that &lt;i&gt;would&lt;/i&gt; work very well, but it doesn't seem that divs can keep from scrolling in IE? the background seems to scroll with the rest of the page unless i put it in the &quot;body&quot; css declaration.. hrm. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top