固定定位哦

这篇博客主要探讨了HTML中固定定位的使用,通过示例展示了如何实现顶部导航条、侧边栏广告的固定定位效果,旨在帮助读者理解并掌握这一布局技巧。
摘要由CSDN通过智能技术生成

 

<!DOCTYPE html>

<html lang="zh-CN">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>固定定位</title>

    <style>

        #box{

            width: 800px;

            height: 1600px;

            background-color: #ff0000;

            margin: 0 auto;

            margin-top: 44px;

        }

        .ad_l{

            width: 120px;

            height: 288px;

            position: fixed;

            top: 100px;

            left: 20px;

        }

        .ad_r{

            width: 120px;

            height: 288px;

            position: fixed;

            top: 100px;

            right: 20px;

        }

        .top{

            width: 100%;

            height: 44px;

            position: fixed;

            top: 0;

            left: 0;

        }

    </style>

</head>

<body>

    <img class="top" src="../images/top.png" alt="">

    <img class="ad_l" src="../images/ad_l.png" alt="">

    <div class="ad_r" id="box">

        <img src="../images/box.png" alt="">

    </div>

</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值