html - 固定元素内溢出

标签 html dom css

我遇到了固定元素及其子元素的问题,它们不希望有滚动条并试图从父元素中脱离出来。你可以在 http://jsfiddle.net/NFV36/ 看到这个.

<div id="documents-popup">
  <div id="documents-popup-inner">
    <div class="controls">Something here which is always visible. And no one knows what height could it be...</div>
    <div class="list-wrap"> 
        <ul class="selector">
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
            <li>6</li>
            <li>7</li>
            <li>8</li>
            <li>9</li>
            <li>Why are you looking at me? I shoud not be visible until you scroll all the way down...</li>
        </ul>
    </div>
  </div>
</div>

我正在尝试使 selector 列表可滚动,高度小于 (#documents-popup-inner + .controls ) 高度与页面的高度无关。我知道,如何用 JS 实现,但是有没有 CSS 解决方案?

最佳答案

你试过吗

overflow-y:scroll;

?

关于html - 固定元素内溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18674937/

相关文章:

html - 一种仅在非移动设备上使用 CSS 类的方法

html - CSS:<li> 并排排列?

css 导航子菜单列表样式类型 : none not working

javascript - FireFox 中的客户端高度

javascript - 查找 JS 代码中引用的 DOM 元素的工具

html - ie8+支持的分割背景色

Python:正则表达式提取html中任意两个标签之间的文本

HTML/CSS - 将按钮更改为指向相反的方向

javascript - Webpack:如何将原始 HTML 加载为 React JSX?

javascript - 使用向上/向下键在表格中的文本字段之间移动