How to scale CSS background to desired dimensions

One can easily scale background in CSS to any dimension to fit its container. 100% CSS background is good looking and gives bump to your design. Here is how this can be done.

#MyID {
    background-size: 70% 60%; /* 70% width and 60% height  */
}

Since this is CSS3 property, supports all browsers after year 2012.

Scroll to Top