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
[css] 第33天 用CSS绘制一个三角形 #119
Comments
.triangle{
width: 0;
border-bottom: 35px solid lightgreen;
border-left: 35px solid transparent;
} |
wrong
|
一般会用伪元素来实现这种装饰性的效果, .triangle:after{
content: '';
border: 35px solid transparent;
border-bottom-color: lightgreen;
} |
三角形的原理就是一个盒子有四个边框交界处都是45度角,当盒子宽高都为0是,最后其实就是一个由4个三角形形成的正方形,给 边上那个三角形就是给 border-right 设置颜色了 |
给 |
看了楼上老哥们的解释感觉太神奇了,在 codepen 上试了一下感觉对盒模型有了个新的认识。 |
等分原理 .arrow {
border: 20px solid transparent;
border-bottom-color:#00aeff ;
display: inline-block;
} |
.triangle {
width: 0;
height: 0;
margin: 100px auto;
border-top: 50px solid transparent;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 50px solid red;
} |
#17 第6天 用css创建一个三角形,并简述原理 |
整了一个空心三角形,效果<div class='rect'></div> .rect {
position: relative;
width: 100px;
height: 100px;
background-color: #fff;
&::before{
position: absolute;
content: '';
bottom: 7px;
left: 20px;
border: 80px solid transparent;
border-bottom-color: white;
z-index: 2;
}
&::after{
position: absolute;
content: '';
bottom: 0px;
border: 100px solid transparent;
border-bottom-color: rgb(34, 230, 220);
z-index: 1;
}
} |
|
.triangle{ |
.triangle { |
第33天 用CSS绘制一个三角形
The text was updated successfully, but these errors were encountered: