纯CSS绘制三角形

相信很多人在处理li图形的时候,都会很纳闷,为什么list-style-type没有三角图案,难度要在网上下个三角图标作为list-style-image?怎么可能呢,所以我整理了网上一些css三角绘制的方法和代码。

Triangle-Up

Triangle-up
#triangle-up {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid red;
}

Triangle-Down

Triangle-Down
#triangle-down {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-top: 100px solid red;
}

Triangle-Left

Triangle-Left
#triangle-left {
    width: 0;
    height: 0;
    border-top: 50px solid transparent;
    border-right: 100px solid red;
    border-bottom: 50px solid transparent;
}

Triangle-Right

Triangle-Right
#triangle-right {
    width: 0;
    height: 0;
    border-top: 50px solid transparent;
    border-left: 100px solid red;
    border-bottom: 50px solid transparent;
}

Triangle-Top-Left

Triangle-Top-Left
#triangle-topleft {
    width: 0;
    height: 0;
    border-top: 100px solid red;
    border-right: 100px solid transparent;
}

Triangle-Top-Right

Triangle-Top-Right
#triangle-topright {
    width: 0;
    height: 0;
    border-top: 100px solid red;
    border-left: 100px solid transparent;
}

Triangle-Bottom-left

Triangle-Bottom-left
#triangle-bottomleft {
    width: 0;
    height: 0;
    border-bottom: 100px solid red;
    border-right: 100px solid transparent;
}

Triangle-Bottom-Right

Triangle-Bottom-Right
#triangle-bottomright {
    width: 0;
    height: 0;
    border-bottom: 100px solid red;
    border-left: 100px solid transparent;
}

你可能感兴趣的:(纯CSS绘制三角形)