Page Widget How to - Create Tooltip Shapes








Question

We would like to know how to create Tooltip Shapes.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.bubble {<!--from www. ja  va  2 s .  c o m-->
  margin: 50px;
  padding: 50px;
  position: relative;
}

.bubble:after {
  content: "";
  position: absolute;
  top: 100%;
  left: 20px;
  border-top: 20px solid blue;
  border-top-color: inherit;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
}
</style>
</head>
<body>
  <div class="bubble" style="background: red; border-color: red;">test</div>
  <div class="bubble" style="background: green; border-color: green;">test</div>
</body>
</html>

The code above is rendered as follows: