468,257 Members | 1,410 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

Why Doesn't this Code Work

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
5 1244
drhowarddrfine
7,435 Expert 4TB
Are you sure the image is actually relative to the location you have the html page at?
Mar 12 '08 #2
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
1,137 1GB
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
7,435 Expert 4TB
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
1,137 1GB
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.

Similar topics

149 posts views Thread by Christopher Benson-Manica | last post: by
4 posts views Thread by bbp | last post: by
10 posts views Thread by Sourcerer | last post: by
6 posts views Thread by Johnny Jörgensen | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.