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] 第65天 用CSS绘制一个红色的爱心 #300
Labels
css
css
Comments
// 用过 就给贴过来了
.heart {
position: relative;
width: 100px;
height: 90px;
}
.heart:before,
.heart:after {
position: absolute;
content: "";
left: 50px;
top: 0;
width: 50px;
height: 80px;
background: red;
border-radius: 50px 50px 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.heart:after {
left: 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
} |
怎么不喜欢贴预览链接呢。 |
与前面老哥的思路一样,用了两个 div 做的。利用 |
.heart {
width: 100px;
height: 100px;
position: relative;
margin-left: 50px;
&:before, &:after {
position: absolute;
width: 50%;
height: 100%;
content: "";
display: inline-block;
background: red;
transform: rotateZ(45deg);
transform-origin: 0 100%;
border-radius: 25px 25px 0 0;
left: 0;
}
&:before{
left: 20%;
transform: rotateZ(-45deg);
transform-origin: 100% 100%;
}
} |
第一反应是用border-radius可以实现
|
很呆萌 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
第65天 用CSS绘制一个红色的爱心
The text was updated successfully, but these errors were encountered: