www.webdeveloper.com
Results 1 to 4 of 4

Thread: Image wont display. and whole page dissappears, if I change any code slightly,

  1. #1
    Join Date
    Apr 2012
    Posts
    110

    Image wont display. and whole page dissappears, if I change any code slightly,

    Hi,
    Is this right, cause I cant get an image on.
    #headline1 {background-image.url('images/models/model2.jpg');
    background-repeat:no-repeat;
    background-position:center;
    padding-top 68px;
    margin-bottom:30px;
    }
    <div id="headline1"><img src="pictures/images/models/model2.jpg" alt="/></div>

    tried putting(../images/models/model2.jpg') but then the whole webpage dissappeared again. And I cant get it back.
    Yesterday, I had a nice design up, but it dissappeared, and I cant get it back either. Is it coffee cup. Does it have a bug, do you think, or could it be my browser.

  2. #2
    Join Date
    Mar 2006
    Location
    Northern UK :((
    Posts
    667
    What is the file path for the file in question?

    Sounds rather over complicated. I just ditch all my images in the same folder.
    99 little bugs in the code, 99 bugs in the code, fix one bug, compile it again ... 101 little bugs in the code

    An important petition, regarding your human rights:
    https://www.change.org/en-GB/petitio...r-both-genders

  3. #3
    Join Date
    Sep 2006
    Location
    new york
    Posts
    266

    need : colon

    You seem to have a period after background-image: url(image.jpg);

    See for instance http://www.w3schools.com/cssref/pr_background-image.asp) or
    http://www.w3schools.com/css/css_background.asp.
    Last edited by auntnini; 05-26-2012 at 03:06 PM. Reason: correction re "quotes"

  4. #4
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Review the correct syntax for background image as suggested. It will look like this example:
    Code:
    background: url('../images/pano5_gradient_bar1.jpg') top center no-repeat;
    Also realize that if the background image is being called from an external style sheet, the path to the image is relative to (starting at) the .css file, not the Web page it's being used on.
    If the css is directly on the Web page... then you can use a path relative to the Web page.
    So in the example I posted above, the "style_sheets" folder is at the same level as my images folder.... so to use that background image (starting at the css file), I have to go up one folder level (the ../ part of the path), then into the images folder.
    In your example:
    Code:
    #headline1 {background-image.url('images/models/model2.jpg');
    You are saying that the images folder is one level below the .css file (which may or may not be correct.
    And yes, you do need to use the colon: not the single period... as mentioned.
    Best wishes,
    Adninjastrator

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