SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: html prob.

  1. #1
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    2
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    html prob.

    I am trying to add a background image for 2 weeks...still i am failing....what i should do to make it right....

  2. #2
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,613
    Mentioned
    65 Post(s)
    Tagged
    2 Thread(s)
    Hi, Anaz23, welcome to the forums. Two weeks is a long time; you must be a very patient person.

    Do you understand how to read and write HTML?

    Do you understand how to read and write any CSS?

    Can you post some code that shows us what you are trying to do... how big the image is and where you want it on the page?

    If you need some help learning how to post code in a message, please click on the link at the bottom of this post and read the examples.

  3. #3
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    2
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i really do have.....ok the picture is in JPEG format and i want to give a background image like <body background="bgJPEG.Image"> oh and the sixe of the picture is 168kb and the size is 960x800 so can you help with that....
    And you see i am just started learning how to make a site using html......

  4. #4
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,613
    Mentioned
    65 Post(s)
    Tagged
    2 Thread(s)
    Hi, Anaz,

    This code example shows how to place a background-image on the body tag using CSS.

    I wrote the CSS background code in "longhand" so you can see the three components easily:
    Code:
    body {
        background-image:url('http://placehold.it/960x800/');
        background-repeat:no-repeat;
        background-position:50% 0;
    }
    That same CSS code can be written in "shorthand" on one line like this:
    Code:
    body {
        background:url('myBgImage.jpg') no-repeat 50% 0;  /* This example shows your background image name */
    }
    You can replace everything between the single quote marks with the path/name of your image and it will appear on your page.

    Are you using a book to help guide your learning? Learning HTML and CSS is much easier if you use a structured course like a book and work the examples in the book. If you are using bits and pieces from different sites on the internet, you will probably miss a lot of important information about how the different elements act alone and interact with each other, so I recommend taking a structured course or following a book.

    You will need to be able to see the suffix of filenames on your computer.

    Copy the following code to a file with an .htm or .html suffix and open it in your browser.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>background-image</title>
        <style type="text/css">
    
    body {
        background-image:url('http://placehold.it/960x800/');  /* Replace this image with your image */
        background-repeat:no-repeat;
        background-position:50% 0;
    }
    
        </style>
    </head>
    <body>
    
    
    
    </body>
    </html>

  5. #5
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    2
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes i thing i am missing some important points.......thanks for your help..


Bookmarks

Posting Permissions

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