<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 0;
height: 0;
border:50px solid transparent;
border-right: 50px solid red;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
コアコードは、border:50pxの透明なソリッド、border-right:50pxの赤いソリッド、三角形の方向は左、
border-left、border-top、border-bottomを設定して、三角形の向きを制御できます。
開発時には、ボックスの前または後の疑似要素に三角形を設定して、対話情報の形状を形成できます。絶対配置で使用されます。
疑似要素はインライン要素であり、変換する必要があります
.tip::before {
position: absolute;
top: 11px;
left: -12px;
display: inline-block;
content: '';
width: 0px;
height: 0px;
border: 6px solid transparent;
border-right: 6px solid #ccc;
}