Effect How to - Create bubble tooltip with transparent border








Question

We would like to know how to create bubble tooltip with transparent border.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#mybox {<!--   w ww. ja va  2 s.c om-->
  width: 200px;
  height: 30px;
  border-style: solid;
  border-width: thin;
  border-color: #000066;
  border-radius: 4px;
  position: relative;
}

#mybox:after, #mybox:before {
  content: "";
  border-style: solid;
  border-width: 10px;
  width: 0;
  height: 0;
  position: absolute;
  top: 100%;
  left: 20px
}

#mybox:before {
  border-color: #000066 transparent transparent;
}

#mybox:after {
  margin-top: -2px;
  border-color: #fff transparent transparent;
}
</style>
</head>
<body>
  <div id="mybox">
    <center>This will be my tooltip</center>
  </div>
</body>
</html>

The code above is rendered as follows: