Glen Morse Glen Morse - 1 year ago 160
CSS Question

css two background images

Kind of new to css but I have one image I want on top left corner and then another image I want to repeat after that. Currently I tired:


background: url('../images/bannerBGs.jpg');
background: url('../images/bannerBGl.jpg');
height: 200px; /*Height of top section*/
color: White;

#topsection a{
color: #FFFF80;

#topsection h1{
margin: 0;
padding-top: 25px;

#topsection h2{
margin: 0;
padding-top: 0px;


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" lang="en" xml:lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IG Indy Gamers</title>
<link rel="stylesheet" type="text/css" href="CSS/mycss.css" media="screen" />
<div id="maincontainer">

<div id="topsection" > <div class="innertube">
<h1>IG -Indy Gamers </h1>
<FONT style="BACKGROUND-COLOR: blue"><p align='right'><a href="#"> &nbspSignup</a> </font> / <a href='Login.html' id='LoginContent' >Login </a></p>
<ul id="list-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Reviews</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Forums</a></li>
<li><a href="#">Demo's</a></li>
<li><a href="#">Members</a></li>
<li><a href="#">Contact</a></li>


but the second image just copies over the first. Can you suggest another way to do this. I heard using layers may do it but I know nothing about that yet.

Answer Source

Looks like CSS3 supports multiple background images; you specify them separated by commas:

background: url('banner1.jpg'), url('banner2.jpg');
background-position: left top, left top;
background-repeat: no-repeat, repeat;

Play with background-position until it does what you want.

IE < 9 does not support this feature.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download