CSS 魔法系列:纯 CSS 绘制三角形,各种角度

Triangle Up

1

2

3

4

5

6

7

#triangle-up {

width:0;

height:0;

border-left:50pxsolidtransparent;

border-right:50pxsolidtransparent;

border-bottom:100pxsolidred;

}

  

Triangle Down

1

2

3

4

5

6

7

#triangle-down {

width:0;

height:0;

border-left:50pxsolidtransparent;

border-right:50pxsolidtransparent;

border-top:100pxsolidred;

}

  

Triangle Left

1

2

3

4

5

6

7

#triangle-left{

width:0;

height:0;

border-top:50pxsolidtransparent;

border-right:100pxsolidred;

border-bottom:50pxsolidtransparent;

}

  

Triangle Right

1

2

3

4

5

6

7

#triangle-right{

width:0;

height:0;

border-top:50pxsolidtransparent;

border-left:100pxsolidred;

border-bottom:50pxsolidtransparent;

}

  

Triangle Top Left

1

2

3

4

5

6

#triangle-topleft {

width:0;

height:0;

border-top:100pxsolidred;

border-right:100pxsolidtransparent;

}

  

Triangle Top Right

1

2

3

4

5

6

7

#triangle-topright {

width:0;

height:0;

border-top:100pxsolidred;

border-left:100pxsolidtransparent;

}

  

Triangle Bottom Left

1

2

3

4

5

6

#triangle-bottomleft {

width:0;

height:0;

border-bottom:100pxsolidred;

border-right:100pxsolidtransparent;

}

  

Triangle Bottom Right

1

2

3

4

5

6

#triangle-bottomright {

width:0;

height:0;

border-bottom:100pxsolidred;

border-left:100pxsolidtransparent;

}