Page Widget How to - Test background-position supported








Question

We would like to know how to test background-position supported.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--  w w w . j  a va2s.  co m-->
  width: 250px;
  height: 250px;
  border: 1px solid green;
  margin: .5em;
  background-image:
    url("http://placehold.it/100x100");
  background-repeat: no-repeat;
}

#keyword-length {
  background-position: left 50px;
}

#keyword-percent {
  background-position: right 50%;
}

#three-values {
  background-position: left 100px bottom;
}

#four-values {
  background-position: right 25% top 50px;
}
</style>
</head>
<body>
  <div id="keyword-length">left 50px</div>
  <div id="keyword-percent">right 50%</div>
  <div id="three-values">left 100px bottom</div>
  <div id="four-values">right 25% top 50px</div>
</body>
</html>

The code above is rendered as follows: