通过css继承来实现气泡小三角

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <style media="screen">
      .callout{position: relative;
         100px;
        height: 50px;
        background: #f00;
      }
      .callout::before{
        content: "";
        position: absolute;
        top: -.4em; left: 1em;
        padding: .35em;
        background: inherit;
        border: inherit;
        border-right:0;
        border-bottom:0;
        transform: rotate(45deg);
      }
    </style>
  </head>
  <body>
    <div class="callout">
      Only
    </div>
  </body>
</html>

原文地址:https://www.cnblogs.com/ron123/p/9568850.html