Results 1 to 2 of 2

Thread: Stretched CSS Background

  1. #1
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Question Stretched CSS Background

    How can I do something with the CSS background like this:
    http://www.thenorthface.com/

    I want the image stretched on the background and not move no matter how big the browser is, it's always full screen.

    It would be great if I could do this with only changing my style.css. I have a Content Management System and they will probably charge me for having to make DIVs. But, I am allowed to change the css for free. If the only way to do this is with DIVs, thats fine, just let me know how.

    Thanks in advanced!!!!!

    -onestopplay

  2. #2
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there onestopplay,

    here is an example that works in Opera, Safari, Konqueror and Firefox...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <style type="text/css">
    html,body {
        margin:0;
        padding:0;
        height:100%;
        background-image:url(http://www.coothead.co.uk/images/blood.jpg);
        -o-background-size:100% 100%;             /*  Opera  */
        -webkit-background-size:100% 100%;        /*  Safari  */
        -khtml-background-size:100% 100%;         /*  Konqueror  */
         -moz-background-size:100% 100%;          /*not working in Firefox as yet, waiting for version 3.6 */
        background-repeat:no-repeat;
        background-attachment:fixed; 
    
    /*firefox work-around*/
    
       -moz-border-image:url(http://www.coothead.co.uk/images/blood.jpg) 0;
        border:0;
    
    /********************/
     }
    </style>
    
    </head>
    <body>
    
    <div></div>
    
    </body>
    </html>
    
    coothead

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
  •