CSS3 实现蒙德里安式抽象图案

CSS3 实现蒙德里安式抽象图案

1.先上代码

1.1 html代码

<body>
    <div id="painting">
        <div id="top-row">
            <div id="big" class="red right"></div>
            <div id="border1" class="black right"></div>
            <div class="medium yellow"></div>
            <div id="border2" class="black small-border"></div>
            <div id="blankbox" class="medium"></div>
        </div>
        <div id="bottom-row">
            <div id="border3" class="black"></div>
            <div id="bottom-left" class="blue left"></div>
            <div id="border4" class="black left"></div>
            <div id="bottom-box" class="left"></div>
            <div class="border5 black left"></div>
            <div id="bottom-small" class="yellow left"></div>
            <div class="border5 black left"></div>
            <div id="bot-right-col">
                <div id="smallest"></div>
                <div id="border6" class="black right"></div>
                <div id="last" class="blue right"></div>
            </div>
        </div>
    </div>
</body>

1.2 CSS代码

body {
    background-color: #f6f6f6;
}
#painting {
    height: 400px;
    width: 400px;
    background-color: #fff4db;
    margin: 30px auto 0 auto;
    box-shadow: 10px 10px 0px #8d8d8d;
}
#top-row {
    height: 290px;
}
#big {
    width: 290px;
    height: 290px;
}
#border1 {
    width: 10px;
    height: 290px;
}
.medium {
    width: 100px;
    height: 140px;
}
.small-border {
    width: 100px;
    height: 10px;
}
#border3 {
    height: 10px;
    width: 400px;
}
#bottom-left {
    height: 100px;
    width: 100px;
}
#border4 {
    height: 100px;
    width: 10px;
}
#bottom-box {
    height: 100px;
    width: 140px;
}
.border5 {
    height: 100px;
    width: 10px;
}
#bottom-small {
    height: 100px;
    width: 100px;
}
#smallest {
    height: 45px;
    width: 20px;
}
#border6 {
    height: 10px;
    width: 30px;
}
#last {
    height: 45px;
    width: 30px;
}
.red {
    background-color: red;
}
.yellow {
    background-color: yellow;
}
.black {
    background-color: black;
}
.blue {
    background-color: blue;
}
.right {
    float: right;
}
.left {
    float: left;
}
2.效果图

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值