Asked by:
background-image not displaying properly

Question
-
User2028249543 posted
Hi,
I am unable to display my CSS background-image in my web form with several attempts failed.
I've tried these several attempts such as:
background-image: url("~/imgmenu/menu_level1_item.png");
background-image: url('~/imgmenu/menu_level1_item.png');
background-image: url(~/imgmenu/menu_level1_item.png);
background-image: url(/imgmenu/menu_level1_item.png);
background-image: url(imgmenu/menu_level1_item.png);
I place my images on my /imgmenu folder on the application root under /WebApplication1 folder, my css file is declared properly.
I could not figure it out on what went wrong.
Please help. Thanks.
Monday, December 5, 2011 6:38 AM
All replies
-
User-362017084 posted
Try
background-image: url(../WebApplication/imgmenu/menu_level1_item.png);
where is ur css file is stored.?
Monday, December 5, 2011 6:47 AM -
User-784583665 posted
use like this
background-image: url('imgmenu/menu_level1_item.png');
Monday, December 5, 2011 6:47 AM -
User551462331 posted
the image folder path should be relative to css file... so this might work considering there are two separate folders one for css and other for image
background-image: url(../imgmenu/menu_level1_item.png);
also, make sure the folder name is imagmenu and not imagemenu... (is e missing in foldername? a thought)
hope this helps...
Monday, December 5, 2011 6:49 AM -
User-771367964 posted
http://www.tizag.com/cssT/background.php
Format-
body
{
background-image:url('gradient2.png');
}Monday, December 5, 2011 6:50 AM -
User2028249543 posted
@chetan,
kindly refer to this 3 links:
http://imageshack.us/photo/my-images/256/cssfolder.jpg/
http://imageshack.us/photo/my-images/191/csscode.jpg/http://imageshack.us/photo/my-images/267/imagefolderlocation.jpg/
Thanks.
Monday, December 5, 2011 10:00 PM -
User551462331 posted
did u try this
background-image: url(../imgmenu/menu_level1_item.png);
this should work
hope this helps...
Tuesday, December 6, 2011 1:45 AM -
Tuesday, December 6, 2011 3:56 AM
-
User-2072789807 posted
you have to create all of the subfolder from within the program. do not create new folders using windows explorer. create a folder named i.e. "Images" by right clicking on your site and then New Folder. then drag and drop any images you want to use into that folder! then use the images you would usually do in the CSS file!
Wednesday, January 4, 2012 6:10 AM -
User1368996525 posted
There should be a problem in your image folder
Sunday, June 17, 2012 1:51 AM -
User1119594843 posted
Hi,
why you sould not use the theme folder that is used in ASP.NET. so that you can have all css and images under one place.
Monday, July 9, 2012 3:04 AM -
User347430248 posted
Hi Sheen,
Try to do like below. it will work.
body { background-image: url("c:\users\v-padee\documents\visual studio 2015\Projects\WebApplication12\WebApplication12\website-design-background.png"); }
Regards
Deepak
Monday, September 5, 2016 7:04 AM