CSS Property Value How to - margin-bottom: -1px; to hide border








Question

We would like to know how to margin-bottom: -1px; to hide border.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--from  w  w w .j av  a2  s.  c  o m-->
  width: 100px;
  height: 100px;
  background: #eee;
}

div:hover {
  width: 100px;
  height: 100px;
  background: #eee;
  border-bottom: 1px solid;
  margin-bottom: -1px;
}
</style>
</head>
<body>
  <div></div>
  <div>test</div>
</body>
</html>

The code above is rendered as follows: