<p class="balloon"> <span class="arrow"> </span>My CSS balloon </p>
.balloon{ position:absolute; left:40px; top:20px; width:200px; height:auto; /* */ background:#fff; padding:10px; -webkit-border-radius:6px; -moz-border-radius:6px; border-radius:6px; } .balloon>.arrow{ position:absolute; left:-10px; top:50%; margin-top:-10px; display:block; width: 0px; height: 0px; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right: 10px solid #fff; }
.balloon>.arrow{ width: 0px; height: 0px; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right: 10px solid #fff; }
.balloon{ position:absolute; } .balloon>.arrow{ position:absolute; }
top = balloonHeight/2 - arrowHeight/2
.balloon>.arrow{ position:absolute; top:50%; }
.balloon>.arrow{ position:absolute; top:50%; margin-top:-10px; }
<p class="balloon"> Balloon </p>
.balloon{ display:block; position:absolute; left:40px; top:20px; width:200px; height:auto; /* */ background:#fff; padding:10px; -webkit-border-radius:6px; -moz-border-radius:6px; border-radius:6px; } .balloon:before{ content: '.'; position:absolute; left:-10px; top:50%; margin-top:-10px; display:block; width: 0px; height: 0px; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right: 10px solid #fff; }
<p class="balloon"> Balloon </p>
.balloon{ display:block; position:absolute; left:40px; top:10px; width:200px; height:auto; background:#fff; padding:10px; -webkit-border-radius:6px; -moz-border-radius:6px; border-radius:6px; moz-box-shadow:0 0 7px #bbb; -webkit-box-shadow:0 0 7px #bbb; box-shadow:0 0 7px #bbb; } .balloon:before{ content:" "; position:absolute; left:-10px; top:50%; margin-top:-10px; z-index:1; display:block; width: 0px; height: 0px; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right: 11px solid #fff; /* */ } .balloon:after{ content:" "; position:absolute; left:0px; top:50%; margin-top:-2px-; z-index:0; display:block; width: 4px; height: 4px; moz-box-shadow:-8px 0 7px #555; -webkit-box-shadow:-8px 0 7px #555; box-shadow:-8px 0 7px #555; }
Source: https://habr.com/ru/post/151140/
All Articles