html - 只想让模式中的关闭按钮溢出可见

标签 html css

我想显示完整的关闭按钮/文本,同时保持模态的 position:fixed 和 overflow:scroll 如果我用 overflow:visible 替换 overflow:scroll 它会完全显示但停止滚动

<div id="root_component">
       <div class="modal" >
               <a class="modal-close btn-floating btn-small 
                   waves-effect waves-light right clearfix">
                        <i class="material-icons">cancel</i>
                    </a>
          <div class="modal-content"></div>
     </div>    
</div>



.modal {
        width: 80% !important;
        overflow-y: scroll;
        z-index: 1003;
        display: block;
        opacity: 1;
        transform: scaleX(1) scaleY(1);
        position: fixed;
        padding: 0;
        margin: auto;
        border-radius: 2px;
    }
    #root_component .clearfix {
        position: absolute;
        right: -16px;
        top: -16px;
        z-index: 100;
    }

screenshot attached

最佳答案

只需将您的 .parent div 包装在另一个 .parent-wrapper div 中,然后将您的 .child div 从 .parent 中取出。这有效:

    .grand-parent {
      position: relative;
      height: 10px;
      width: 10px;
      background: red;
      top: 10px;
    }

    .parent-wrapper {
      height: 150px;
      width: 60px;
      position: fixed;
    }

    .parent {
      height: 150px;
      width: 60px;
      overflow: scroll;
      background: blue;
    }

    .child {
      overflow: visible;
      position: absolute;
      top: 10px;
      left: 20px;
      background: yellow;
    }
<div class="grand-parent">
      <div></div>
      <div class="parent-wrapper">
        <div class="parent">adfasdf<br> asdf
          <br> asdf
          <br> adsf
          <br> asdfasd
          <br> fads
          <br> fdsaf
          <br> sadfasd
          <br> afdsf
        </div>
        <div class="child"> close</div>
      </div>
    </div>

关于html - 只想让模式中的关闭按钮溢出可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55010288/

相关文章:

html - 使用固定高度标题保持内容 div 纵横比

python - Django 2.0 ModelForm dateField 不显示为小部件

javascript - 根据输入表单中输入的内容分别弹出不同的表单

html - 使用 flexbox 在 bootstrap 列中安装图像

css - 删除 <a4j :jsFunction> 中的 CSS 样式

javascript - 严重困扰 WOW.js 并与 animate.css 集成

html - 文档堆叠上下文根元素 : <body> or <html>?

html - 删除 Google Chrome 上的输入焦点

javascript - W3 响应式导航栏不适用于我的应用程序

css - 无法在样板模板中插入背景图像