简体   繁体   English

带有 header、内容和页脚部分的响应式模态对话框

[英]Responsive modal dialog with header, content & footer section

I have a modal, header and footer are sticky and the middle section scrolls based on the content.我有一个模态,header 和页脚是粘性的,中间部分根据内容滚动。

On Desktop it works perfectly fine, however on mobile, tablet, the footer is stretched and not shown 100%.在桌面上它工作得非常好,但在移动设备、平板电脑上,页脚被拉伸并且没有 100% 显示。

I wish to achieve the height responsive dialog with header/footer sticky and content section scrolling.我希望通过页眉/页脚粘性和内容部分滚动来实现高度响应对话框。

What am I doing wrong here?我在这里做错了什么?

 .modal { width: 500px; display: flex; text-align: left; flex-direction: column; }.header { height: 204px; }.content { top: 204px; bottom: 72px; overflow-y: auto; }.footer { height: 72px; flex-shrink: 0; overflow: hidden; }
 <div class="modal"> <div class="header"> Header Content </div> <div class="content"> Content Section </div> <div class="footer"> Footer Section </div> </div>

make the width of the modal to 100%, but then set the max-width to 500px.将模态框的宽度设置为 100%,然后将最大宽度设置为 500px。

You can do it like this:你可以这样做:

.modal {
  max-width: 500px;
  width: 100%;
  display: flex;
  text-align: left;
  flex-direction: column;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM