Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Adding a background

    I am very new to Html and CSS and I am having problems with my background.

    It shows up in the browser but doesn't fill the whole of the screen, so I am left with white space. Here is the code for the css and html.

    CSS

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>
    <title>this is the title of the web page</title>

    <style type="text/css">

    body
    #content{width:1920px}
    #content{height:1080px}
    #content
    {background:url(../images/background.gif)}
    background-repeat: no-repeat;


    </style>

    </head>
    <body>
    </body>
    </html>



    HTML

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
    <head>
    <title></title>
    <meta name="keywords" content="your, keywords, here" />
    <meta name="description" content="your description here" />
    <meta name="author" content="your name here" />
    <link rel="stylesheet" type="text/css" href="style/style2.css" />
    </head>
    <body>
    <!-- main content section -->
    <div id="content">

    <h1> Lawrence's Page </h1>
    <h2> Web Project </h2>
    <ul>
    <li><a href= "wep/first.html" tabindex="1" title= "My first valid XHTML webpage"> View My First Page</a></li>
    <li><a href= "wep/about_me.html" tabindex="1" title= "about_me valid XHTML webpage"> About Me</a></li>
    <li><a href= "wep/poem.html" tabindex="1" title= "poem valid XHTML webpage"> Poem</a></li>
    <li><a href= "wep/semantics.html" tabindex="1" title= "semantics valid XHTML webpage"> Semantics</a></li>
    </ul>
    <p>
    <a href="http://validator.w3.org/check?uri=referer"><img
    src="http://www.w3.org/Icons/valid-xhtml11"
    alt="Valid XHTML 1.1" height="31" width="88" /></a>
    </p>
    </body>
    </html>

    Any help much be appreciated and as I said, I am very new to this

  • #2
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Unless you're an amazing writer, don't include more than a couple of sentences of background information at a time, and include background information only when it's necessary to help the reader understand what's happening in the story. Writing three long paragraphs of background on the first page is right out.

    (If you think you're an amazing writer, the chances are you're not.)

    Background information might be interesting or important, but it's not as interesting or important as what your characters are doing right now - and if it is, something is wrong with your plot or your characters or both.

  • #3
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,950
    Thanks
    9
    Thanked 724 Times in 718 Posts
    Quote Originally Posted by Hannan2011 View Post
    Background information might be interesting or important, but it's not as interesting or important as what your characters are doing right now - and if it is, something is wrong with your plot or your characters or both.
    I hope you're joking....

    Re the OP's question - a number of things:

    Your css file, if that's what you've posted above,should only have css in it, not html as you've posted, and the css contained within the style tags is incorrect. You need a .css file which just contains:

    Code:
    #content{width:1920px;height:1080px;background:url(../images/background.gif);background-repeat: no-repeat;}
    Assuming that your background image is showing anyway, then is the image actually big enough to provide a background for your content div? The background won't be stretched automatically.

    Remove xml tag at the top of your html.

    You're missing a closing </div> tag for #content.

    I suspect this still may not fix everything - in which case can you give a link to your page - without the image it's hard to give more accurate responses.


  •  

    Tags for this Thread

    Posting Permissions

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