弹性盒布局——骰子布局

本文介绍了如何使用CSS3的弹性盒布局来创建骰子布局。内容提到骰子布局的关键在于将每个骰子元素设置为独立的弹性盒,以确保它们在布局中居中且稳定。
摘要由CSDN通过智能技术生成

弹性盒布局-骰子布局

弹性盒布局

个人认为正常的骰子应该是这样的排布的,不是太复杂,一点应该就是在正中间,不会随便挪动的吧(菜鸡发言hh)
总代码:(每个骰子分别弹性盒布局就好)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>弹性盒布局_骰子布局</title>
    <style>
        div{
     
            display: flex;
        }
        .block{
     
            display: flex;
            flex-wrap: wrap;
            background-color: #000;
            width: 800px;
            justify-content: center;
            align-content: center;
            margin-left: 350px;
        }
        .box{
     
            display: flex;
            width: 200px;
            height: 200px;
            box-sizing: border-box;
            padding: 25px;
            background: linear-gradient(#FFF 5%,grey 90%,#FFF);
            border-radius: 20px;
            margin: 25px;
        }
        .item{
     
            width: 40px;
            height: 40px;
            background: #000;
            border-radius: 50%;
        }
        .box1{
     
            justify-content: center;
            align-items: center;
        }
        .box2{
     
            justify-content: space-between;
        }
        .box2 .item:nth-child(2){
     
            align-self: flex-end;
        }
        .box3{
     
            justify-content: space-between;
        }
        .box3 .item:nth-child(2){
     
            align-self: center;
        }
        .box3 .item:nth-child(3){
     
            align-self: flex-end;
        }
        .box4,.box5{
     
            flex-wrap: wrap;
            align-content: space-between;
        }
        .box5 div.another{
     
            align-items: center;
            display: flex;
            justify-self: center;
            flex-basis: 100%;
            justify-content: center;
        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

牛奶小柒Luke

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值