How to set background size (height & width)?

27,262

You want to use background-size: 100%. Ensure that its browser support is compatible with your supported platforms.

$("#Stage").css({ 
     "background-image": "url(BG.jpg)", 
     "background-attachment": "fixed",
     "background-size": "100%"
});
Share:
27,262
Chris Lad
Author by

Chris Lad

Updated on December 08, 2020

Comments

  • Chris Lad
    Chris Lad over 3 years

    I'm very new to JavaScript.

    My code so far:

    $("#Stage").css(
      "background-image",
      "url(BG.jpg)",
      "background-attachment", 
      "fixed"
    );
    

    What I want to do is have the background image at a set size so lets say: width: 100% and height: 100%.