CSS Property Value How to - background-size:cover








Question

We would like to know how to background-size:cover.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!-- w  w  w . j a v  a 2 s.com-->
  width: 100%;
  height: 560px;
}

.minhaClass {
  background: url(http://placehold.it/200x200) no-repeat center center;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
</style>
</head>
<body>
  <div class="minhaClass"></div>
</body>
</html>

The code above is rendered as follows: