HTML CSS examples for CSS Property:background-size
Stop background overflowing outside of its width/height with background-size: contain
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div {<!--from w w w. j a va 2 s. co m--> background:url('https://www.java3s.com/style/demo/Google-Chrome.png') no-repeat center center; background-size:contain; height:201px; } </style> </head> <body> <div> </div> </body> </html>