Use pseudo elements (before, after) in css3 to generate direction arrow signs

 Other directions can be generated by changing the direction

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width: 300px;
            height: 300px;
            /*添加渐变:渐变不是一个单一钩,它产生的是图像,所以需要使用background*/
            /*linear-gradient(方向,开始颜色 位置,颜色2 位置,颜色3 位置...);*/
            /*方向:
            to top:0deg
            to right:90deg
            to bottom:180deg --默认值
            to left:270deg*/
            /*background: linear-gradient(to right,red,blue)*/;
            /*background: linear-gradient(to right,red 0%,red 50%,blue 50%,blue 100%);*/
			
			background: linear-gradient(45deg,blue 0%,blue 50%);
			
        }
		div::after {
        content: '';
        /*right: -11px;*/
        top: 283px;
		position: absolute;
		height: 50px;
		width: 50px;
        /*生成三角形箭头
		background: linear-gradient(135deg, red 0%,red 50%,transparent 50%,transparent 100%);
//转变三角形箭头指向
		transform: rotate(225deg);
      }
    </style>
</head>
<body>
<div></div>
</body>
</html>

Published 64 original articles · Like9 · Visit 110,000+

Guess you like

Origin blog.csdn.net/eadela/article/details/103669052