Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-09-2012, 02:04 AM   PM User | #1
Yaz1994
New to the CF scene

 
Join Date: Nov 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Yaz1994 is an unknown quantity at this point
Background Image not working Css

Hi, This is my first post here! I am stuck with some CSS, I am trying to link an image to my stylesheet but it does not work unless it is in the style sheet folder bearing in mind that the image is in a diffrent folder. My folder structure is:
- As > Css > style.css
- As > images > banner.jpg

when I do <img src="..\images\banner.jpg"> the image works perfectly fine, when I put that into my css nothing comes up:
background-image:url('..\images\banner.jpg');

tried a lot of diffrent things such as:
background-image:url('\images\banner.jpg');
background-image:url('..\images\banner.jpg');
background-image:url('..\..\images\banner.jpg');

I'd be very grateful if someone is willing to help me fix my issue!
Thanks!!!
Yaz1994 is offline   Reply With Quote
Old 11-09-2012, 02:59 AM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,335
Thanks: 13
Thanked 207 Times in 207 Posts
DanInMa is on a distinguished road
looks fine, you probably need to show more or it's an environment issue, like it's not on your webserver or you are viewing it locally or it missing or something, there are other possibilities but your syntax appears fine.
what element are you applying this background image to?
does it have enough height and width to display the image?
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 11-09-2012, 03:23 AM   PM User | #3
minder
Banned

 
Join Date: Oct 2012
Posts: 81
Thanks: 0
Thanked 4 Times in 4 Posts
minder can only hope to improve
The relative path to your image in your css needs to be relative to the folder the css file is in, which you have and so that is not your problem.

There are many possibilities as to why your image is not appearing.

How are you linking your external stylesheet to your html file?

Have you some embedded css in your html file stopping the bg image from appearing?

etc

etc

etc

Post your actual code so people can see what is going on.
minder is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:59 PM.


Advertisement
Log in to turn off these ads.