Page Widget How to - Create bubble with arrow on the right








Question

We would like to know how to create bubble with arrow on the right.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#demo {<!--  w  w  w  .  ja va  2s.com-->
  width: 90px;
  height: 30px;
  background-color: #ccc;
  position: relative;
  border: 4px solid #333;
  border-radius: 12px;
  -webkit-box-shadow: inset 5px 5px 15px rgba(255, 255, 255, 0.9);
  padding: 15px;
  text-align: center;
}

#demo:after, #demo:before {
  border: solid transparent;
  content: ' ';
  height: 0;
  left: 100%;
  position: absolute;
  width: 0;
}

#demo:after {
  border-width: 9px;
  border-left-color: #ccc;
  top: 15px;
}

#demo:before {
  border-width: 14px;
  border-left-color: #333;
  top: 10px;
}
</style>
</head>
<body>
  <div id="demo">java2s.com</div>
</body>
</html>

The code above is rendered as follows: