Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jul 2016
    Posts
    1
    Member #
    54616

    Question Issues with CSS background image

    Hello I'm new here in the forums so please be gentle...

    Anyways I'm trying to add a background image to my site, and am having issues with it not showing up. I figured it was my code and tried it in a basic page just to make sure, but it's still not working, and I don't know what's going on. I've tried a lot of different stuff on the web, adding quotes and display:block and such. Any help would be appreciated. Here's the code I'm using in my HTML and CSS:

    CSS
    body {background:url(image.jpg);}

    HTML
    <html>
    <head>
    <title>Simple HTML Page
    </title>
    </head>
    <body>
    <center>
    <h1>Simple HTML Page</h1>
    <p>This is a very simple HTML page.</p>
    <p>It's about as basic as they come.</p>
    <ul style="ul">
    <li>List Item 1</li>
    <li>List Item 2</li>
    <li>List Item 3</li>
    </ul>
    </center>
    </body>
    </html>

  2.  

  3. #2
    Senior Member khenney's Avatar
    Join Date
    Apr 2016
    Location
    Half Moon Bay, California
    Posts
    276
    Member #
    53911
    Liked
    148 times
    That should work. It's common to wrap the image url in quotes but it should still work without them.

    Do you have the page online that you could link to? Maybe there's something else wrong.

    You could try adding a background color as well to see if it's just an issue with the image you're trying to link to. Trying changing your CSS to:
    body {background:#0000FF url(image.jpg);}
    and make sure the background turns blue. If it does, the problem is with your image URL.
    Last edited by khenney; Jul 06th, 2016 at 11:49 AM.
    Kevin Henney
    CRUCIAL CREATIVE
    Web Development - Graphic Design - Branding

  4. #3
    Senior Member
    Join Date
    Feb 2006
    Posts
    800
    Member #
    12463
    Liked
    298 times
    You have to link to your CSS file from within your HTML file (in the head section).

    <link rel="stylesheet" type="text/css" href="url of css file" />

  5. #4
    Junior Member
    Join Date
    May 2016
    Location
    Bangalroe, India
    Posts
    3
    Member #
    54168
    Try to use this inline css code

    body {
    background-image: url("image.jpg");
    }

  6. #5
    Junior Member asadul549's Avatar
    Join Date
    Aug 2016
    Location
    Bogra, BD
    Posts
    8
    Member #
    54891
    Liked
    2 times
    I don't have the solution in fact I also faced this problem so many times. In that case I usually would use inline css

    <style>
    body {background:url(image.jpg);}
    </style>


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:41 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com