Blogger Information
Blog 5
fans 0
comment 0
visits 2417
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
css布局原理与实现-2019年9月4日20时
贝瀚企管Jason的博客
Original
458 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>
        .box1 {
            width: 250px;
            border: 5px dashed rebeccapurple;
            overflow: hidden;
        }
        
        .box2 {
            width: inherit;
            height: 300px;
            background-color: lawngreen;
            float: left;
        }
    </style>
</head>

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

</body>

</html>

运行实例 »

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

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>Document</title>
    <style>
        .box1 {
            width: 300px;
            height: 600px;
            background-color: lawngreen;
        }
        
        .box2 {
            width: 300px;
            height: 600px;
            background-color: lightcoral;
            position: relative;
            left: 300px;
            top: -600px;
        }
        
        .box3 {
            width: 300px;
            height: 600px;
            background-color: lightblue;
            position: relative;
            left: 600px;
            top: -1200px;
        }
    </style>
</head>

<body>
    <div class="parent">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></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