css
I,

/* 上記の効果を得る */
<style>
div {
width: 0;
height: 0;
border-top: 10px solid red;
border-right: 10px solid green;
border-bottom: 10px solid blue;
border-left: 10px solid pink;
}
</style>
<body>
<div></div>
</body>
II、

/* 上記の効果を得る */
<style>
p {
width: 0;
height: 0;
border-style: solid;
border-width: 10px;
border-color: red transparent transparent transparent;
font-size: 0;
line-height: 0;
}
</style>
<body>
<p></p>
</body>
- 三角形の効果はcssのボーダーでシミュレートできます。
- の幅と高さは0
- 4つのボーダーをすべて書き、必要なボーダーの色だけを残し、残りは省略できません。
- 下位ブラウザとの互換性を保つために、font-size: 0; line-height: 0; および