Blogger Information
Blog 13
fans 0
comment 0
visits 5457
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第五节课html标签元素属性作业-2019-9-4 作业
鹰弘网络科技的博客
Original
649 people have browsed it
  1. 实例演示如何消除子元素浮动造成父元素高度折叠的影响

实例

<!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>消除子元素浮动造成父元素高度折叠的影响</title>
    <style>
        .box {
            width: 200px;
            border: 5px dashed blue;
            overflow: hidden;
        }
        
        .box1 {
            width: 200px;
            height: 200px;
            background: lightgreen;
            float: left;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="box1"></div>
    </div>
</body>

</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

  1. 2. 实例演示三列布局的实现原理( 绝对定位实现, 浮动定位实现)

实例

<!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>绝对定位布局</title>
    <style>
        .box {
            width: 1000px;
            margin: 0 auto;
        }
        
        .header {
            width: 100%;
            height: 50px;
            background: lightgrey;
        }
        
        .footer {
            width: 100%;
            height: 50px;
            background: lightgrey;
        }
        
        .main {
            background: lightblue;
            margin: 5px auto;
            position: relative;
        }
        
        .left {
            width: 200px;
            background: lightpink;
            min-height: 800px;
            position: absolute;
            left: 0;
            top: 0;
        }
        
        .right {
            width: 200px;
            background: yellow;
            min-height: 800px;
            position: absolute;
            right: 0;
            top: 0;
        }
        
        .content {
            min-height: 800px;
            background: lightseagreen;
            margin-left: 200px;
            margin-right: 200px;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="header">网页头部</div>
        <div class="main">
            <div class="left">左边</div>
            <div class="content">中间</div>
            <div class="right">右边</div>
        </div>
        <div class="footer">网页尾部</div>
    </div>
</body>

</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

实例

<!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>浮动布局</title>
    <style>
        .box {
            width: 1000px;
            margin: 0 auto;
        }
        
        .header {
            width: 100%;
            height: 50px;
            background: lightgrey;
        }
        
        .footer {
            width: 100%;
            height: 50px;
            background: lightgrey;
        }
        
        .main {
            background: lightblue;
            margin: 5px auto;
            position: relative;
            overflow: hidden;
        }
        
        .left {
            background: lightcoral;
            width: 200px;
            min-height: 800px;
            float: left;
        }
        
        .right {
            background: lightseagreen;
            width: 200px;
            min-height: 800px;
            float: right;
        }
        
        .content {
            background: yellow;
            width: 600px;
            min-height: 800px;
            float: left;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="header">网页头部</div>
        <div class="main">
            <div class="left">左边</div>
            <div class="content">中间</div>
            <div class="right">右边</div>
        </div>
        <div class="footer">网页尾部</div>
    </div>
</body>

</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

Correction status:qualified

Teacher's comments:和前面的作业一样, 没有写总结
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post