css horizontal center, css adjust the position of the background image, css draw a triangle

Horizontal adjustment of the element position 

width: 300px;
margin: auto;
position: absolute;
left: 0;
right: 0;

 Horizontal adjustment background image

background-position-x: -600px;//水平方向,同理垂直y也可以调整

 

#triangle03{
    width: 0;
    height: 0;
    border: 50px solid transparent;
    border-top: 50px solid blue;
    }
#triangle04{
    width: 0;
    height: 0;
    border: 50px solid transparent;
    border-right: 50px solid red;
    }
#triangle05{
    width: 0;
    height: 0;
    border: 50px solid transparent;
    border-bottom: 50px solid green;
    }
#triangle06{
    width: 0;
    height: 0;
    border: 50px solid transparent;
    border-left: 50px solid yellow;
    }

The above code can be achieved, the triangle four different directions.

Triangular four different directions

Published 242 original articles · won praise 13 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_41813208/article/details/103639414