【问题标题】:How to stop parent containers from resizing to fit dynamic content如何阻止父容器调整大小以适应动态内容
【发布时间】:2021-03-10 05:55:42
【问题描述】:

我有这样的设置

<app-component> <!-- need this to not fit the content but be reactively sized-->
 <div> <!--display:flex-->
  <form> <!-- display: flex-->
   <div> <!-- display: block-->
    <section> <!-- display: flex-->
     <div> <!-- display:flex-->
      <app-component> width:100%-->
       <div> <!-- display: flex row-->
        <div> <!-- overflow-x: scroll, whitespace: nowrap-->
          ***inserted here are photos the user is uploading***
          ***this extends from left to right ***
        </div>
       </div>
      </app-component>
     </div>
    </section>
   </div>
  </form>
 </div>
<app-component>

问题是第一个应用程序组件正在调整大小以适应继续添加的图像。包含图像的即时 div 及其包含的 div 都可以正常运行,但包含的应用程序组件适合不可见的照片,这会导致整个页面脱落。

我可以通过设置宽度的静态参数轻松解决这个问题,但这是一个反应式应用程序,必须缩放到所有不同的屏幕尺寸,所以我想知道是否有人有一个很好的解决方案来保持 css 流畅而不需要添加特定的像素大小。

【问题讨论】:

    标签: html angular sass


    【解决方案1】:

    您是否尝试将容器设置为视口单位?

    width: 100vw;
    height: 100vh;
    overflow: auto;
    

    【讨论】:

      猜你喜欢
      • 2011-05-02
      • 1970-01-01
      • 2013-06-04
      • 1970-01-01
      • 2016-06-05
      • 1970-01-01
      • 1970-01-01
      • 2011-08-20
      • 1970-01-01
      相关资源
      最近更新 更多