Control background image with CSSTag(s): HTML/CSS


NOTE: You place this code in the HEAD section of your page.

  • Regular
    <STYLE> 
      body 
      { 
          background-image: 
          url(../images/backg.gif) 
      } 
    </STYLE>
    TRY IT HERE.

  • Tile vertically (repeat-y) or horizontally (repeat-x)
    <STYLE> 
        body 
        { 
          background-image: 
          url(../images/backg.gif); 
          background-repeat: repeat-x
        } 
    </STYLE> 
    TRY IT HERE.

  • Center with no repeat
    <STYLE> 
        body 
        { 
            background-image: 
            url(../images/backg.gif); 
            background-repeat: no-repeat; 
            background-position: center center 
        } 
    </STYLE>
    TRY IT HERE.

  • Center and no scroll (IE only)
    <STYLE> 
        body 
        { 
            background-image: 
            url(../images/backg.gif); 
            background-repeat: no-repeat; 
            background-position: top center; 
            background-attachment: fixed 
        } 
    </STYLE>
    TRY IT HERE.
    blog comments powered by Disqus