How to scale CSS background to desired dimensions

Share

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.

  • May 10, 2014
8 Best Free Stock Video Websites for Tiktok, Reels, and Shorts Top 5 PHP Frameworks: Fast and Secure