Resize background image in div using css

With this code, you can resize background image in div automatically using css:

  1. CSS:
    <style type="text/css">   
    #contentMain {  
      margin-bottom: 5%; 
      margin-top: 10%;
      margin-left: 10%;
      margin-right: 10%;
      background: url( /jQuery/mypage/img/background1.png );    
      background-size: contain; 
    } 
    </style> 

Reference link: http://stackoverflow.com/questions/6028737/resize-background-image-in-div-using-css

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s