浮动布局练习

浮动布局练习
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浮动练习一</title>
    <style>
        body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td {
            margin: 0;
            padding: 0
        }

        .head {
            width: 980px;
            height: 100px;
            margin: 0 auto;
            text-align: center;
        }

        .head .logo {
            width: 250px;
            height: 100px;
            background-color: #ffc0cb;
            float: left;
        }

        .head .language {
            width: 150px;
            height: 50px;
            background-color: #87ceeb;
            float: right;
        }

        .head .nav {
            width: 650px;
            height: 50px;
            background-color: #800080;
            float: right;
        }

        .content {
            width: 980px;
            height: 400px;
            margin: 0 auto;
            margin-top: 10px;
            text-align: center;
        }

        .content .aside {
            width: 320px;
            height: 400px;
            float: left;
            background-color: #ffff00;

        }

        .content .article {
            width: 650px;
            height: 400px;
            float: right;
        }

        .content .article .articleBottom {
            width: 400px;
            height: 200px;
            background-color: #00bfff;
            float: left;
        }

        .content .articleTop {
            width: 400px;
            height: 200px;
            background-color: #00bfff;
            float: left;
        }

        .content .article .articleTopRight {
            width: 240px;
            height: 350px;
            float: right;
            background-color: #008000;
        }

        .content .article .articleBottomLeft {
            width: 400px;
            height: 140px;
            float: left;
            background-color: #ff6347;
            margin-top: 10px;
        }

        .content .article .articleBottom {
            width: 650px;
            height: 40px;
            background-color: #b8860b;
            float: left;
            margin-top: 10px;

        }
        .foot {
            width: 980px;
            height: 40px;
            background-color: #ff6347;
            margin: 10px auto;
        }


    </style>
</head>
<body>
<div class="head">
    <div class="logo">250*100</div>
    <div class="language">150*50</div>
    <div class="nav">650*50</div>
</div>
<div class="content ">
    <div class="aside">320*400</div>
    <div class="article">
        <div class="articleTop">400*200</div>
        <div class="articleTopRight">240*350</div>
        <div class="articleBottomLeft">400*140</div>
        <div class="articleBottom">650*40</div>
    </div>
</div>
<div class="foot"></div>
</body>
</html>

在这里插入图片描述

注意点:

1.在标准流中内容的高度可以撑起父元素的高度。

2.但是在浮动流中浮动元素不可以撑起父元素的高度的。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值