请老师检查,谢谢!
来源:2-8 编程练习
Cloud_轩
2020-12-21 15:44:57
# 具体遇到的问题
# 报错信息的截图
# 相关课程内容截图
# 尝试过的解决思路和结果
# 粘贴全部相关代码,切记添加代码注释(请勿截图)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>国旗</title>
<style type="text/css">
*{margin: 0; padding: 0; border: none;}
.flag{
width: 600px;
height: 400px;
background: red;
margin: 100px auto;
position: relative;
}
.star{
width: 0;
height: 0;
border-top: 70px solid yellow;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
transform: scale(0.5);
position: absolute;
top: 70px;
}
.star::before,
.star::after{
display: block;
content: "";
width: 0;
height: 0;
border-top: 70px solid yellow;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
position: absolute;
}
.star::before{
left: -100px;
top: -70px;
transform: rotate(70deg);
}
.star::after{
right: -100px;
top: -70px;
transform: rotate(-71deg);
}
.star:nth-child(2){
left: 90px;
top: 5px;
transform: scale(0.2) rotate(20deg);
}
.star:nth-child(3){
left: 130px;
top: 45px;
transform: scale(0.2) rotate(-10deg);
}
.star:nth-child(4){
left: 130px;
top: 100px;
transform: scale(0.2);
}
.star:nth-child(5){
left: 90px;
top: 140px;
transform: scale(0.2) rotate(20deg);
}
</style>
</head>
<body>
<div class="flag">
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
</div>
</body>
</html>
1回答
好帮手慕星星
2020-12-21
同学你好,代码布局实现效果很棒。继续加油,祝学习愉快!
相似问题