html - 怎么才能用css画出这种结构来?我不用flex我发现我写不出来?

查看:81
本文介绍了html - 怎么才能用css画出这种结构来?我不用flex我发现我写不出来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

用四个div加上颜色代替就行,感激不尽,好半天了画不出来。。求喷。
不要用5个div标签 就用四个怎么写?

解决方案

下面这个能不能满足要求

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div{
            box-sizing: border-box;
        }

        .parent {
            width: 310px;
            height: 310px;
            border: 2px solid darkcyan;
        }

        .first{
            float: left;
            width: 150px;
            height: 300px;
            border: 1px solid red;
        }

        .second {
            width: 150px;
            height: 150px;
            border: 1px solid blue;
            display: inline-block;
        }

        .third {
            width: 75px;
            height: 150px;
            display: inline-block;
            border: 1px solid green;
        }
    </style>
</head>

<body>
    <div class="parent">
        <div class="first"></div>
        <div class="second"></div>
        <div class="third"></div>
        <div class="third"></div>
    </div>
</body>

</html>

这篇关于html - 怎么才能用css画出这种结构来?我不用flex我发现我写不出来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆