首页 > 其他分享 >浮动布局小练习

浮动布局小练习

时间:2024-01-28 16:44:08浏览次数:35  
标签:浮动 栏目 布局 练习 height width 10px line margin

设计图

分析如下

分析图

实现代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 主页面 -->
    <div class="container">
        <!-- 头部 -->
        <div class="page-hear clearfix">
            <div class="logo leftfix">logo</div>
            <div class="banner1 leftfix">banner1</div>
            <div class="banner2 leftfix">banner2</div>
        </div>
        <!-- 菜单 -->
        <div class="menu">菜单</div>
        <!-- 内容 -->
        <div class="content clearfix">
            <!-- 左边内容区 -->
            <div class="left leftfix">
                <div class="top clearfix">
                    <div class="item1 leftfix">栏目一</div>
                    <div class="item2 leftfix">栏目二</div>
                </div>
                <div class="bottom clearfix">
                    <div class="item3 leftfix">栏目三</div>
                    <div class="item4 leftfix">栏目四</div>
                    <div class="item5 leftfix">栏目五</div>
                    <div class="item6 leftfix">栏目六</div>
                </div>
            </div>
            <!-- 右边内容区 -->
            <div class="right leftfix">
                <div class="item7">栏目七</div>
                <div class="item8">栏目八</div>
                <div class="item9">栏目九</div>
            </div>
        </div>
        <!-- 页脚 -->
        <div class="footer">页脚</div>
    </div>
</body>
</html>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    .leftfix{
        float: left;
    }
    .clearfix::after{
        content: "";
        display: block;
        clear: both;
    }
    .container{
        width: 960px;
        margin: 0 auto;
        text-align: center;
    }
    .logo,.banner2{
        height: 80px;
        width: 200px;
        background-color: #ccc;
        line-height: 80px;
    }
    .banner1{
        height: 80px;
        width: 540px;
        background-color: #ccc;
        margin: 0 10px;
        line-height: 80px;
    }
    .menu{
        background-color: #ccc;
        margin: 10px 0;
        width: 960px;
        height: 30px;
        line-height: 30px;
    }
    .item1,.item2{
        border: 1px black solid;
        height: 200px;
        width: 368px;
        margin-right: 10px;
        line-height: 200px;
    }
    .item3,.item4,.item5,.item6{
        border: 1px black solid;
        width: 178px;
        height: 200px;
        margin-right: 10px;
        line-height: 200px;
        margin-top: 10px;
    }
    .item7,.item8,.item9{
        border: 1px black solid;
        width: 198px;
        height: 130px;
        line-height: 130px;
    }
    .item8{
        margin: 10px 0;
    }
    .footer{
        margin-top: 10px;
        background-color: #ccc;
        height: 60px;
        width: 960px;
        line-height: 60px;
    }
</style>

标签:浮动,栏目,布局,练习,height,width,10px,line,margin
From: https://www.cnblogs.com/liuguangshuo/p/17992993

相关文章

  • 【#C】练习题:请输出100以内的素数
    这里给出两种方法。素数就是指:除了能被1和自身整除,不能被其他数整除。这两种方法的思路,在根本上是一致的。例如对于34而言,在2~33内的如果能被34整除,就说明不是素数;如果在此范围内没有数能被34整除,就说明是素数。然后因为1不是素数,所以对2~100内的每个数进行判断。1、自定义函数法:运......
  • AndroidStudio 编辑xml布局文件卡死问题解决
    之前项目编写的都是正常,升级AndroidStudio后编辑布局文件就卡死,还以为是AndroidStudio文件。其实不然,我给整个项目增加了版权声明。所以全部跟新后,布局文件也增加了版权声明。估计AndroidStudio在解析布局文件时候因为有版权声明的原因导致卡死,所以删除版权声明就可以了。可以......
  • 牛客练习赛121补题
    C.思路由于水滴会影响一个区间里的水滴,所以只需要为何区间[l,r]即可ac代码#include<bits/stdc++.h>usingnamespacestd;usingi64=longlong;consti64inf=1e18;typedefpair<int,int>pii;constintmod=1e9+7;constintN=2e5+10;inta[N];intn......
  • 牛客练习赛121
    牛客练习赛121出题人题解|牛客练习赛121题解小念吹气球解题思路:字符长度加字符种类数。代码:#include<bits/stdc++.h>usingnamespacestd;usingll=longlong;usingpii=pair<ll,ll>;#definefifirst#definesesecondusingi128=__int128_t;voidso......
  • 2024.01.25 近期练习
    CF1856E2如果\(n\le5000\)考虑怎么做。首先我们对于每个节点只考虑大小关系,最后只需要从小到大标号即可。我们考虑把答案放到LCA处统计。若其只有两个儿子\(v_1,v_2\),那最多只有\(siz_{v_1}\timessiz_{v_2}\)个会被统计,即令\(v_1\)所有数大于\(v_2\)。若有多个儿......
  • 每日一练 | 华为认证真题练习Day172
    1、关于OSPF的ASBR-SUMMARY-LSA中LSA头部他、信息描述错误的是A.LINKSTATEID表示ASBR的ROUTERIDB.ADVERTISINGROUTER表示该ABR的ROUTERIDC.ADVERTISINGROUTER字段永远不会改变D.METRIC表示该ABR到达ASBR的OSPF开销2、关于OSPF外部路由种类描述错误的是A.OSPF分为第一类......
  • Python web crawler(2.1)多循环嵌套练习
    写个函数,传入(书名:book,标题:tittle,内容:content),要求在book文件夹下(不存在则创建),创建每个tittle.txt文件,写入content内容importosdefsave_to_file(folder_book,title,content):#如果文件夹不存在,则创建ifnotos.path.exists(folder_book):os.makedirs(......
  • 看别人的codereview:变量布局,变量和这个变量保护的变量;什么时候封装;lazyinit
    怎么布局变量和这个变量保护的变量我是按这个实践的。比如我前几天自己写的一个工具,用m来保护locks.typevariable[Kcomparable]struct{ flockerFactory msync.Mutex//guardlcoks locksmap[K]refTryLocker}什么时候封装这位"DeletedUser"给出的建议:"onel......
  • 浮动路由及负载均衡
    拓扑:配置:查看代码[R1]discurrent-configuration[V200R003C00]#sysnameR1#boardadd0/12SA#snmp-agentlocal-engineid800007DB03000000000000snmp-agent#clocktimezoneChina-Standard-Timeminus08:00:00#portallocal-serverloadportalpage.......
  • 无涯教程-CSS3 - 多列布局
    CSS3可以将文本内容设计成像报纸一样的多列布局。一些最常用的多列属性,如下所示-Sr.No.Value&Remark1column-count 指定元素应该被分割的列数。2column-fill指定如何填充列3column-gap 指定列与列之间的间隙4column-rule所有column-rule-*属性的简......