2020-09-15

前端的布局练习----骰子

效果图一:

在这里插入图片描述
html代码:

<div class="box">
     <span class="item"></span>
     <span class="item1"></span>
     <span class="item2"></span>
     <span class="item3"></span>
</div>

css代码:

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(top, #222, #333);
  }

.box{
    margin: 16px;
    padding: 4px;
    background-color: #e7e7e7;
    width: 90px;
    height: 90px;
    display: flex;
    justify-content:space-between;
    align-content:space-between;
    flex-wrap: wrap;
    /*W3school上的flex-wrap属性:row-reverse*/
    flex-direction:row-reverse;
    /*菜鸟教程上的flex-direction属性:row-reverse*/
}

.item{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}

.item1{
    width: 25px;
    height: 25px;
    background-color: brown;
    border-radius: 50%;
}
.item2{
    width: 25px;
    height: 25px;
    background-color:coral;
    border-radius: 50%;
}
.item3{
    width: 25px;
    height: 25px;
    background-color:blueviolet;
    border-radius: 50%;
    align-self:flex-end;
}

效果二:

在这里插入图片描述
html代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="E:\Web前端\Learning\Try_Third.css">
    <title>Document</title>
 </head>
 <body>
<div class="box">
    <div class="a">
     <span class="item"></span>
     <span class="item1"></span>
    </div>
    <div class="b">
     <span class="item2"></span>
     <span class="item3"></span>
    </div>
</div>
 </body>
</html>

css代码块:

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(top, #222, #333);
  }

.box{
    margin: 16px;
    padding: 4px;
    background-color: #e7e7e7;
    width: 90px;
    height: 90px;
    display: flex;
    justify-content:space-between;
    flex-wrap: wrap;
    align-content: space-between;

}
.a{
    display: flex;
    flex-basis:100%;
    justify-content:space-between;
}
.item{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}

.item1{
    width: 25px;
    height: 25px;
    background-color: brown;
    border-radius: 50%;
}
.b{
    display: flex;
    flex-basis:100%;
    justify-content:space-between;
}
.item2{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}

.item3{
    width: 25px;
    height: 25px;
    background-color: brown;
    border-radius: 50%;
}

效果三

在这里插入图片描述
代码可参考效果二。

效果四:

在这里插入图片描述
html代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="E:\Web前端\Learning\Try_Third.css">
    <title>Document</title>
 </head>
 <body>
<div class="box">
    <div class="a">
     <span class="item"></span>
     <span class="item1"></span>
     <span class="item2"></span>
    </div>
    <div class="b">
     <span class="item3"></span>
     <span class="item4"></span>
     <span class="item5"></span>
    </div>
</div>
 </body>
</html>

css代码:

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(top, #222, #333);
  }

.box{
    margin: 16px;
    padding: 4px;
    background-color: #e7e7e7;
    width: 90px;
    height: 90px;
    display: flex;
    flex-direction:column;
    flex-wrap: wrap;
    align-content: space-between;

}
.a{
    display: flex;
    flex-basis:100%;
    flex-direction:column;
    justify-content:space-between;
}
.item{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}

.item1{
    width: 25px;
    height: 25px;
    background-color: brown;
    border-radius: 50%;
}
.item2{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}
.b{
    display: flex;
    flex-basis:100%;
    flex-direction:column;
    justify-content:space-between;
}
.item3{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}
.item4{
    width: 25px;
    height: 25px;
    background-color: brown;
    border-radius: 50%;
}
.item5{
    width: 25px;
    height: 25px;
    background-color:black;
    border-radius: 50%;
}

效果五:在这里插入图片描述

html代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="E:\Web前端\Learning\Try_Third.css">
    <title>Document</title>
 </head>
 <body>
<div class="box">
    <div class="a">
     <span class="item"></span>
     <span class="item1"></span>
     <span class="item2"></span>
    </div>
    <div class="b">
     <span class="item3"></span>
    </div>
    <div class="c">
     <span class="item4"></span>
     <span class="item5"></span>
    </div>
</div>
 </body>
</html>

css代码:

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(top, #222, #333);
  }

.box{
    margin: 16px;
    padding: 4px;
    background-color: #e7e7e7;
    width: 90px;
    height: 90px;
    display: flex;
    flex-wrap: wrap;
    align-content: space-between;

}
.a{
    display: flex;
    flex-basis:100%;
    justify-content:space-between;
}
.item{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}

.item1{
    width: 25px;
    height: 25px;
    background-color: brown;
    border-radius: 50%;
}
.item2{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}
.b{
    display: flex;
    flex-basis:100%;
    justify-content:center;
}
.item3{
    width: 25px;
    height: 25px;
    background-color: black;
    border-radius: 50%;

}
.c{
    flex-basis:100%;
    display: flex;
    justify-content:space-between;
}
.item4{
    width: 25px;
    height: 25px;
    background-color: brown;
    border-radius: 50%;
    align-self: center;
}
.item5{
    width: 25px;
    height: 25px;
    background-color:black;
    border-radius: 50%;
}

效果六:

html代码:

<div class="box">
     <span class="item"></span>
     <span class="item"></span>
     <span class="item"></span>
     <span class="item"></span>
     <span class="item"></span>
     <span class="item"></span>
     <span class="item"></span>
     <span class="item"></span>
     <span class="item"></span>
</div>

css代码:
body {
font-family: ‘Open Sans’, sans-serif;
background: linear-gradient(top, #222, #333);
}

.box{
margin: 16px;
padding: 4px;
background-color: #e7e7e7;
width: 90px;
height: 90px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: space-between;
}
.item{
width: 25px;
height: 25px;
background-color: black;
border-radius: 50%;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值