Blogger Information
Blog 15
fans 0
comment 1
visits 15155
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
前端布局-固定定位实现小广告
空城的博客
Original
709 people have browsed it

固定定位可以看做绝对定位的一种特例,相比与绝对定位寻找父级的位置,固定定位直接寻找最顶级的位置

实例

<!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>
    <!-- <link rel="stylesheet" href="staic/css/style03.css"> -->
    <style>
        body {
            height: 2000px;
        }

        .guanggao {
            position: fixed;
            width: 450px;
            height: 450px;
            background-color: #ccc;
            text-align: center;
            right: 0px;
            bottom: 0px;

        }

        h2 {
            line-height: 450px;
        }

        .guanggao button {
            float: right;
            background-color: red;

        }
    </style>
</head>

<body>

    <div class="guanggao">
        <button onclick="this.parentNode.style.display = 'none'">关闭</button>
        <h2>澳门赌场,线上招商</h2>
    </div>
</body>

</html>

运行实例 »

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


Correction status:Uncorrected

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