Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2009
    Location
    Brentwood, Essex.
    Posts
    586
    Tokens
    236

    Default HTML background image

    bit of a noob question but I googled a few things and couldn't find anything. basically, i'm making a website using html and i basically just want to use a background image.

    the image i want is similar to the twitter setup (so the main content goes through the center) leaving two gaps either side.

    does anyone know a shorter way to do this or how i would be able to do this via a background image?

    merci

  2. #2
    Join Date
    Aug 2010
    Location
    Glasgow
    Posts
    7,144
    Tokens
    2,989

    Latest Awards:

    Default

    body
    {
    background-image:url('imagelink');
    }

    http://www.w3schools.com/html/default.asp
    Last edited by David; 06-04-2012 at 10:49 PM.

  3. #3
    Join Date
    Apr 2009
    Location
    Brentwood, Essex.
    Posts
    586
    Tokens
    236

    Default

    Quote Originally Posted by Dave. View Post
    body
    {
    background-image:url('imagelink');
    }

    http://www.w3schools.com/html/default.asp
    I think I tried this when I was in college the other day and the code didn't work.. it looks similar. I will try it out in a moment - thanks Dave

  4. #4
    Join Date
    Nov 2005
    Posts
    7,708
    Tokens
    3,967
    Habbo
    Kasabian

    Latest Awards:

    Default

    <html>

    <head>
    <style type="text/css">
    body
    {
    background-image:url('insertyourbackgroundlinkhere.png');
    background-repeat:no-repeat;
    background-attachment:fixed;
    background-position:center;
    }
    </style>
    </head>

    <body>
    main content of your website
    </body>

    </html>

    Try that?

  5. #5
    Join Date
    May 2011
    Location
    England
    Posts
    427
    Tokens
    3,403
    Habbo
    Pension

    Latest Awards:

    Default

    Try this my friend.
    HTML Code:
    <!DOCTYPE html>
    <html>
    <head>
        <title>Pension</title>
        <meta charset="utf-8">
        <style type="text/css">
            body {
                background: url('path/to/bg.png');
            }
        </style>
    </head>
    <body>
        content here
    </body>
    </html>

    robbie // pension.

  6. #6
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    4,753
    Tokens
    1,860
    Habbo
    ,Alpha,

    Latest Awards:

    Default

    I do recommend http://w3schools.com if your starting out - it helped me a lot a few years ago and still does today!

  7. #7
    Join Date
    Apr 2009
    Location
    Brentwood, Essex.
    Posts
    586
    Tokens
    236

    Default

    nothing is working

  8. #8
    Join Date
    Jan 2011
    Location
    England, United Kingdom
    Posts
    253
    Tokens
    40
    Habbo
    Pegle

    Latest Awards:

    Default

    Have you made sure that you are leading to the image location correctly?

    So if say you are working in folder Jim and your index.html/php file is in Jim and your image file is in imgs and called bg.png you have it set out like this:

    HTML Code:
    <style type="text/css">         
    body {             
              background: url('/imgs/bg.png');         
    }     
    </style>
    Hope that helps.


  9. #9
    Join Date
    Apr 2011
    Posts
    11
    Tokens
    0

    Default

    <style type="text/css">
    body
    {
    background: #000000 url(bg.png) fixed;
    }
    </style>

Posting Permissions

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