首页 > Web开发 > 详细

css 脱离文档流

时间:2019-07-06 19:44:02      阅读:100      评论:0      收藏:0      [点我收藏+]

一、float

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>脱离文本流</title>
    <style>
        .c1{
            height: 100px;
            width: 100px;
            background-color: brown;
        }

        .c2 {
            height: 150px;
            width: 150px;
            background-color: blueviolet;
            float: right;
        }

        .c3 {
            height: 200px;
            width: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
<div class="c1"></div>
<div class="c2"></div>
<div class="c3"></div>
</body>
</html>

二、absolute

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>脱离文本流</title>
    <style>
        .c1{
            height: 100px;
            width: 100px;
            background-color: brown;
        }

        .c2 {
            height: 150px;
            width: 150px;
            background-color: blueviolet;
            position: absolute;
            left: 200px;
        }

        .c3 {
            height: 200px;
            width: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
<div class="c1"></div>
<div class="c2"></div>
<div class="c3"></div>
</body>
</html>

三、fixed

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>脱离文本流</title>
    <style>
        .c1{
            height: 100px;
            width: 100px;
            background-color: brown;
        }

        .c2 {
            height: 150px;
            width: 150px;
            background-color: blueviolet;
            position: fixed;
            left: 400px;
        }

        .c3 {
            height: 200px;
            width: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
<div class="c1"></div>
<div class="c2"></div>
<div class="c3"></div>
</body>
</html>

 

css 脱离文档流

原文:https://www.cnblogs.com/wt7018/p/11143750.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!