www.webdeveloper.com
Results 1 to 4 of 4

Thread: background img dont work

  1. #1
    Join Date
    Oct 2012
    Posts
    2

    background img dont work

    hello i try to put img for my nav bar but it doesnt work..

    heres my code in css:
    Code:
    @charset "utf-8";
    /* CSS Document */
    
    body {
    	background: url('../img/bg.PNG') bottom center no-repeat;
    }
    html {
    	background: url('../img/bg.PNG') top center no-repeat;
    }
    #navigation {
    	background-image:url('../img/nav.PNG') no-repeat;
    	width: 666px;
    	height: 56px;
    	display:inline-block;
    }
    the image route is correct and i dont know whats the problem why the image doesnt show..

  2. #2
    Join Date
    Mar 2011
    Posts
    1,159
    The relative URLs in your stylesheet are probably incorrect. Keep in mind that relative URLs in stylesheets are relative to the location of the stylesheet, not the parent HTML document. Try changing to complete URLs (ie. 'http://www.example.com/img/bg.PNG'). If those work then you know your relative URLs are incorrect.

  3. #3
    Join Date
    Sep 2006
    Location
    new york
    Posts
    267
    See for example http://www.w3schools.com/css/css_background.asp
    CSS properties used for background effects:

    background-color
    background-image
    background-repeat
    background-attachment
    background-position
    You seem to be mixing "specific" (-image) rules and "shorthand" background- rules. Believe, when you specify background-image, you do not include other aspects (such as no-repeat). Likewise, when you use background: shorthand, you have to include at least one other related property (such as color, position, etc.).

    Also wonder about the one that has no position specified?

  4. #4
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    Check your paths, as the other poster mentioned. Also, avoid inline-block. It's problematic. Display it as 'block' but float it left.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles