Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question DIV background image does not show

    I made a website, and the background image of a DIV never showed up, so I got mad and deleted it all just to try again - with no luck.

    As you can see here in this example, I have made a simple page with the following CSS:

    Code:
    body {
    	background-color: #000000;
    }
    #1th-logo {
    	height:69px;
    	width:165px;
    	background-image: url(../images/1th.png);
    	}
    p {
    	color: #FFFFFF;
    }
    Really simple.

    And this is the code in my HTML:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/html4/strict.dtd"> 
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <link href="css/stylesheet.css" rel="stylesheet" type="text/css" media="screen"/>
    </head>
    <body>
    	<div id="1th-logo">
    	  <p>asdasdasd</p>
    	  <p>asd</p>
    	  <p>asd</p>
    	  <p>asd</p>
    	  <p>asd</p>
    	  <p>asd</p>
    </div>
    <img src="images/1th.png" width="165" height="69">
    </body>
    </html>
    Also really simple.

    And this is how it looks in dreamweaver:



    (I just filled in some random text to prove my point)

    And now, this is the output:

    http://www.thedaniel.dk/heidi/

    As you can see, I've used an image tag and added the same image, but not in CSS. This works.

    So, how the **** do I get that div to show the background image?

    This is the simplest method I could do and yet it still isn't working.
    Last edited by D4CH; 05-25-2010 at 12:26 PM. Reason: SOLVED

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The CSS validator will give you the reason, see http://jigsaw.w3.org/css-validator/v...ning=1&lang=en

    You can't have the value of an id attribute starting with a number.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    The CSS validator will give you the reason, see http://jigsaw.w3.org/css-validator/v...ning=1&lang=en

    You can't have the value of an id attribute starting with a number.
    Well I'll be damned ...

    Thanks a million!


  •  

    Posting Permissions

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