Hello and welcome to our community! Is this your first visit?
Register
Results 1 to 6 of 6
  1. #1
    Enthusiast

    Join Date
    Apr 2008
    Location
    Inside your animashunz having fun with Mr. default :D
    Posts
    2,078

    Background image for <div> not working

    HTML:
    Code:
    <div id="content" >
    		</div>


    CSS:
    Code:
    #content {
    	background-image:url(bg.jpg);
    	width: 851px;
    	height: 100%;
    	margin-left: auto;
    	margin-right: auto;
    	padding-top: 10px;
    	
    }
    That's not the whole code but I just want to make sure it's right. I had the bg.jpg in images folder, but since it was not working, I tried putting it in the root and in still doesn't work. I even tried using the html tag for background image but that didn't even work, I made sure the background image name and the extension was correct too.

  2. #2
    Insanity Skype's Avatar



    Join Date
    Apr 2007
    Location
    England
    Posts
    27,397

    Re: Background image for <div> not working

    Put something in it, or give height an actual value ( 800px, eg )

  3. #3
    Enthusiast

    Join Date
    Apr 2008
    Location
    Inside your animashunz having fun with Mr. default :D
    Posts
    2,078

    Re: Background image for <div> not working

    I tried putting a test paragraph and an image and setting the height in pixels but the image still did not show up.

  4. #4
    Veteran Enthusiast LeadingManNigel's Avatar


    Join Date
    May 2005
    Location
    New York City
    Posts
    6,213

    Re: Background image for <div> not working

    Have you tried setting a repeat value?

  5. #5
    Obsessed Veteran Adam's Avatar



    Join Date
    Nov 2004
    Location
    UK / England
    Posts
    17,271

    Re: Background image for <div> not working

    Check the file location. If you use firefox. Use the firebug extension. Then use the inspect tool over the div, hover over the url in the style window if the image doesn't load there's your problem.

  6. #6
    Enthusiast

    Join Date
    Apr 2008
    Location
    Inside your animashunz having fun with Mr. default :D
    Posts
    2,078

    Re: Background image for <div> not working

    lol, thanks Adam. It worked.

    Requesting lock now.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •