How do I make my scrollable panel to fill the entire screen down to the footer with responsive design? (for mobile interface) [duplicate]

情到浓时终转凉″ 提交于 2020-01-05 06:45:29

问题


I am doing a mobile version of my result pageso it has to be responsive for every mobile devices, but i don't know how to make my panel(who is scrollable) fill the screen down to the footer no matter on what mobile is the user it should look the same. if i try to fix the height of the panel with px or vh it's not the same for all device so it's not responsive and if i try to set a % value i can't make my panel scrollable anymore, any idea ?

Here's the code:

CSS

    list_mobile {

  .result {
  height: border-box;
  }
  .footer {
    position: fixed;
    width: 100%;
    bottom: 0;
    height: 5vh;
    background: skyblue;
    color: black;
  }
}

.res_mobile {
  height: 57vh;
  overflow: scroll;
  overflow-x: hidden;
}

HTML

<div class="container-fluid">
  <div class="row">
    <div class="col-12">
      <div class="panel panel-info">
        <div class="panel-heading">
          <h4 class="panel-title">
            <span>Results</span>
          </h4>
        </div>
          <div class="panel-collapse collapse in">
            <!-- content -->
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="row list_mobile">
  <footer class="footer">
    <p>number of results : 55 </p>
  </footer>
</div>

回答1:


Change .footer class Style

.res_mobile {
  height: 57vh;
  overflow: scroll;
  overflow-x: hidden;
}
.footer {
   position: fixed;
   left: 0;
   bottom: 0;
   width: 100%;
   background-color: red;
   color: white;
   text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container-fluid">
  <div class="row">
    <div class="col-12">
      <div class="panel panel-info">
        <div class="panel-heading">
          <h4 class="panel-title">
            <span>Results</span>
          </h4>
        </div>
        <div class="panel-collapse collapse in">
          <!-- content -->
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="row list_mobile">
  <footer class="footer">
    <p>number of results : 55 </p>
  </footer>
</div>


来源:https://stackoverflow.com/questions/50738690/how-do-i-make-my-scrollable-panel-to-fill-the-entire-screen-down-to-the-footer-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!