Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

利用border制作三角形以及箭头 #13

Open
54leibo opened this issue Mar 20, 2020 · 0 comments
Open

利用border制作三角形以及箭头 #13

54leibo opened this issue Mar 20, 2020 · 0 comments

Comments

@54leibo
Copy link
Owner

54leibo commented Mar 20, 2020

// 宽度和高度设置为0,再把另外三个border背景设置为transparent
#box{
 position: relative;
 width:0;
 height:0;
 border: 20px solid transparent;
 border-top-color:red;
 border-bottom-width:0;
}

// 如果需要空心三角形(箭头),利用before再叠加一个,正确设置其背景色,border宽度小一个像素,调整left和top值即可
#box: before {
 content: ' ';
 position: absolute;
 left: -19px;
 top: -21px;
 width:0;
 height:0;
 border: 19px solid transparent;
 border-top-color:#fff;
 border-bottom-width:0;
}
@54leibo 54leibo changed the title 利用border制作三角形 利用border制作三角形以及箭头 Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant