www.webdeveloper.com
Results 1 to 5 of 5

Thread: loading background image of a div

  1. #1
    Join Date
    May 2008
    Posts
    297

    loading background image of a div

    i can't seem to load the background image with the code below...

    <div align="center"; style="background-image:url('../images/banner1.png');">

    and the one without the quotes doesnt work either...
    <div align="center"; style="background-image:url(../images/banner1.png);">

    how can i load the background image?

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Both will work if the div has content or height & width have been defined.

    Remove the semi-colon
    Code:
    <div align="center"; style
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    May 2008
    Posts
    297
    Quote Originally Posted by Fang View Post
    Both will work if the div has content or height & width have been defined.

    Remove the semi-colon
    Code:
    <div align="center"; style
    ok there is width and height but i had removed the width and height in the code, for the sake of posting clarity. Here is the code right now, and I also removed the semi - colon.

    <div align="center" style="background-image:url('../images/banner1.png'); padding:50px 0px 0px 0px; width: 690px; height: 300px; float:left;">

    still not bringging up the background image. and yes the div has content in it, it is an amazon.com widget, does it have any effect?

  4. #4
    Join Date
    Apr 2010
    Posts
    213
    Check the url... the server is probably looking for the files relative to the server root, in which case '../images/...' wouldn't make much sense.

  5. #5
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Assuming the path and file name is correct, then the widget is probably covering the div so you won't see the background image.
    At least 98% of internet users' DNA is identical to that of chimpanzees

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