View Single Post
  #1 (permalink)  
Old February 2nd, 2010, 07:17 AM
StevenF StevenF is offline
Authorized User
 
Join Date: Apr 2009
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default DIV CSS background-image does not display

I am unable to set a DIV background image using CSS. I have tried to set several images, and imagetypes (.gif, .png, .jpeg) as DIV background images, using several different techniques (applying a CSS class to the DIV, applying a CSS DIV element ID, and setting the background-image style of the DIV directly). With all these attemps, the result is the same: all I end up with is a blank background. I am sure (I sincerely hope!!) that I am missing something really basic. Here's my code - any suggestions for what's going wrong would be much appreciated:

CSS code
Code:
#BackgroundTest   
{   
    background-image: url('Images/keys.jpeg');   
    background-repeat: repeat;   
}   
.BackgroundTestClass   
{   
    background-image: url('Images/keys.jpeg');   
    background-repeat: repeat;   
}
ASP.NET code
Code:
<head runat="server">
    <title></title>
    <link href="../Styles/TestStyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    
    <div id="BackgroundTest">
        Some test text
    </div>
    
    <div class="BackgroundTestClass">
        Some more test text
    </div>
    
    <div style="background-image: url(Images/keys.jpeg);">
        Even more test text
    </div>
    
    </form>
</body>