为什么不出现滚动条? CSS

在网上搜索fixed与absolute的区别,看到一段代码,复制到本地后,用浏览器打开,却没有滚动条??<!DOCTYPEhtml><head><metahttp-equ... 在网上搜索fixed与absolute的区别,看到一段代码,复制到本地后,用浏览器打开,却没有滚动条??
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <style>
        body {
        height:1000px; /*让窗体出现滚动条*/
        }
        .fixed {
            position: fixed;
            left: 100px;
            right: 100px;
            top: 100px;
            bottom: 100px;
            width: auto;
            height: auto;
            border: 1px solid blue;
            
        }
        .absolute {
            position: absolute;
            left: 100px;
            right: 100px;
            top: 100px;
            bottom: 100px;
            width: auto;
            height: auto;
            border: 1px solid red;
        }
    </style>
</head>
<body>
    <div class="fixed">fixed定位</div>
    <div class="absolute">absolute定位</div>
</body>
</html>
为什么下面这段就出现了滚动条呢?
<!DOCTYPE html>

<head>
<meta charset="UTF-8">
<title>Document</title>

<style>
div{width:100px; height:100px; background: green;}
#left{position:absolute; left:0; top:100px;}
#right{position:fixed; right:0; top:100px;}
</style>

</head>

<body style="height:1000px">
<div id="left">absolute</div>
<div id="right">fixed</div>
</body>
</html>
展开
 我来答
qm5621309
2018-10-23 · TA获得超过239个赞
知道小有建树答主
回答量:272
采纳率:41%
帮助的人:38.2万
展开全部
哥们啊 有没有滚动条是个屏幕的分辨和你定义的网页最大宽度有关的 和position一毛钱关系都没有啊
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式