By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,785 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,785 IT Pros & Developers. It's quick & easy.

Why Doesn't this Code Work

P: 11
hi all,

I am having a simple CSS file with the following tag:

.topdivision
{
width:100%;
height:100px;
background-image:url(../images/banner5.jpg);
background-repeat:no-repeat;
background-position:center;
}

And as I am using this with ASP.NET page, I have given a reference in the page as:
<link href="App_Themes/rainy/rainy.css" rel="Stylesheet" type="text/css" />

and I have used the "topdivision" tag like:

<div id="div_top" class="topdivision" runat="server"></div>

I think everybit of process is fine, but I am unable to view the image I am using as a background(banner5.jpg) image.
Can you help me through.

Regards,
Royal
Mar 12 '08 #1
Share this Question
Share on Google+
5 Replies


drhowarddrfine
Expert 5K+
P: 7,435
Are you sure the image is actually relative to the location you have the html page at?
Mar 12 '08 #2

P: 11
if I don't use the CSS and I try to display the images as:

<div id="topdiv" style="background-image:url(/images/banner5.jpg)"></div>


it works fine this way. But I want to do the same thing using CSS.

Regards,

Royal
Mar 14 '08 #3

Death Slaught
100+
P: 1,137
Try changing you code to this, and see if it works.

Expand|Select|Wrap|Line Numbers
  1.  .topdivision {
  2.   width:100%;
  3.   height:100px;
  4.   background-image:url(http://www.thescripts.com/forum/customavatars/avatar129709_10.gif);
  5.   background-repeat:no-repeat;    
  6.   background-position:center;
  7. }
And if it doesn't change you code to this.

Expand|Select|Wrap|Line Numbers
  1.  .topdivision {
  2.   width:100%;
  3.   height:100px;
  4.   background-image: url(http://www.thescripts.com/forum/customavatars/avatar129709_10.gif);
  5.   background-repeat:no-repeat;    
  6.   background-position:center;
  7. }
Thanks, Death
Mar 14 '08 #4

drhowarddrfine
Expert 5K+
P: 7,435
In the CSS, you are using a different relative path. There you show ../ while in the other you just show /
Mar 14 '08 #5

Death Slaught
100+
P: 1,137
I was working more around a certain ' ' which has caused myself issues in the past.

~_^ Thanks, Death
Mar 14 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.