你可以像下面这样做.我知道代码看起来很疯狂,但我很快就会有一篇关于它的详细文章.在此之前,您只需调整几个变量即可控制形状:
.tooltip {
--r: 30px; /* border radius*/
--b: 5px; /* border length */
--s: 30px; /* arrow size */
--c: linear-gradient(60deg,#E84A5F,#355C7D);
max-width: 410px;
font-size: 20px;
padding: calc(var(--r) + var(--b));
position: relative;
font-weight: bold;
font-family: sans-serif;
}
.tooltip::before {
content: "";
position: absolute;
inset: calc(-1*var(--s));
border-radius: calc(var(--r) + var(--s));
border: var(--s) solid #0000;
padding: var(--b);
background: var(--c) border-box;
-webkit-mask:
conic-gradient(from -60deg at calc(80% - var(--b)) calc(100% - var(--b)/1.4), #000 60deg,#0000 0)
50% calc(100% - var(--b)) /100% var(--s) no-repeat,
linear-gradient(#000 0 0) content-box,
conic-gradient(from -60deg at 80% 100%, #000 60deg,#0000 0)
bottom/100% var(--s) no-repeat,
linear-gradient(#000 0 0) padding-box;
-webkit-mask-composite: xor;
mask-composite: exclude;
}
body {
margin: 0;
min-height: 100vh;
display: grid;
place-content: center;
background: #b7e3f1;
}
<p class="tooltip">
Sugar plum ice cream icing apple pie cotton candy gummi bears chupa chups cheesecake apple pie. Biscuit macaroon biscuit chocolate cake tiramisu. Wafer cupcake gummi bears tiramisu gingerbread icing lemon drops. Chocolate chocolate bar bonbon cake wafer oat cake. Lemon drops wafer cookie cake tiramisu
</p>