ReinerLau1 / Blog

Just a blog
MIT License
0 stars 0 forks source link

实现一个三角形 #262

Closed ReinerLau1 closed 2 years ago

ReinerLau1 commented 2 years ago

原理

div {
    width: 0;
    height: 0;
    border: 100px solid;
    border-color: orange blue red green;
}

image

ReinerLau1 commented 2 years ago

向下的三角形

div {
    width: 0;
    height: 0;
    border-top: 50px solid red;
    border-right: 50px solid transparent;
    border-left: 50px solid transparent;
}

image

ReinerLau1 commented 2 years ago

向上的三角形

div {
    width: 0;
    height: 0;
    border-bottom: 50px solid red;
    border-right: 50px solid transparent;
    border-left: 50px solid transparent;
}

image

ReinerLau1 commented 2 years ago

向右的三角形

div {
    width: 0;
    height: 0;
    border-left: 50px solid red;
    border-top: 50px solid transparent;
    border-bottom: 50px solid transparent;
}

image

ReinerLau1 commented 2 years ago

向左的三角形

div {
    width: 0;
    height: 0;
    border-right: 50px solid red;
    border-top: 50px solid transparent;
    border-bottom: 50px solid transparent;
}

image

ReinerLau1 commented 2 years ago

斜三角形

div {
    width: 0;
    height: 0;
    border-top: 100px solid red;
    border-right: 100px solid red;
}

image