[css]三角形を設置する方法

おさらい的な。

borderでやる

div{
    width: 0;
    height: 0;
    border: 12px solid transparent;
    border-top: 12px solid #111;
}

色を指定する場所によって三角形の向きが変わる。形状は縦と横の長さを調整すれば変えられる。

アイコンでやる

Googleフォントにある単色の三角形は1個だけ。ドロップダウン用的なやつなので、用途によっては微妙。

::before{
    content:"e5c5";
    font-family: "material icons";
}
Material Symbols and Icons - Google Fonts
Material Symbols are our newest icons consolidating over 2,500 glyphs in a single font file with a wide range of design ...

fontawesomeは角丸やらいろんな向きのやつがある。

Find the Perfect Icon for Your Project | Font Awesome
Search all the icons and match your project with a look and feel that's just right, including the all-new Sharp Solid Ic...

コメント

タイトルとURLをコピーしました