位置为负时,如何显示滚动条? [英] how can i have scrollbar when position is negative?

查看:92
本文介绍了位置为负时,如何显示滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当位置为正时,滚动条就可以正常工作.但是当left为负数时,滚动条将不会显示.当元素位于左侧还是右侧时,我如何拥有滚动条?

When position is positive, scrollbar work just fine. but when left is negative, scrollbar won't apear. how can i have scrollbar when element is on the left side or on the right side?

示例在这里:

.container{
    position: relative;
    width: 350px;
    height: 250px;
    background: gray;
    overflow: scroll;
    margin: 10px auto;
}
.child {
    position: absolute;
    top : 200px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: white;
    border: 1px solid blue;
}

<div class="container">
    <div class="child"></div>
</div>

推荐答案

您似乎无法做到这一点,因为浏览器未提供该功能.

It seems like you cannot do that, because the browsers do not provide that feature.

这是我在查看WebDriver规范后的理解 http://w3c.github.io/webdriver/webdriver-spec.html

This is my understanding after looking at the WebDriver spec http://w3c.github.io/webdriver/webdriver-spec.html

在标题为确定是否显示元素"的部分中

In the section titled 'Determining if an element is displayed'

有一点说 用户代理不得允许负向滚动"

there is a point that says "The User Agent must not allow negative scrolling"

这篇关于位置为负时,如何显示滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆