<html>
<head>
<style>
#example1 {
border: 2px solid black;
padding: 25px;
background: url(mountain.jpg);
background-repeat: no-repeat;
background-size: contain;
}
</style>
</head>
<body>
<h2>background-size: contain:</h2>
<div id="example1">
<h2>Hello World</h2>
<p>The background image is resized to make sure the image is fully visible.</p>
</div>
<p><strong>Note:</strong> The background-size property is not supported in Internet Explorer 8 and earlier versions.</p>
</body>
<!-- Mirrored from www.w3schools.com/cssref/tryit.asp?filename=trycss3_background-size4 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:00:12 GMT -->
</html>