JSFiddle - React, Tailwind, and code Playground
by jury1
HTML
<div class="speech-bubble speech-bubble-top">
<p>Здесь текст.</p>
</div>
CSS
/*
Speech Bubbles
Usage: Apply a class of .speech-bubble and .speech-bubble-DIRECTION
<div class="speech-bubble speech-bubble-top">Hi there</div>
*/
body {
background-color:green;
}
.speech-bubble {
position: relative;
background-color: red;
margin: 20px;
width: 200px;
height: 150px;
line-height: 150px; /* вертикально по центру */
color: white;
text-align: center;
border-radius: px;
font-family: sans-serif;
}
.speech-bubble:after {
content: '';
position: absolute;
width: 0;
height: 0;
border: 15px solid;
}
/* разместите стрелку */
.speech-bubble-top:after {
border-right-color: yellow;
right: 100%;
bottom: 50%;
margin-left: -25px;
}
.speech-bubble-top:after {
border-top-color: yellow;
right: 100%;
bottom: 50%;
margin-left: -25px;
}