引导,如何始终将中间行包含在标题行和页脚行之间



我最近在此显示器中添加了img样式,我为max-height:100% and max-width:100%似乎只使用图像还可以,但是我已经意识到,如果我的中间行(可以包含一个或两个并排列(有多个图像或周围带有文本的图像,它在较大的分辨率下完全脱离行。

问题是,此页面在大型电视和显示器上显示用户创建的内容,因此此时中间行已完全将页脚行推出视野,中间内容向下拉伸。

我不知道这是否是我应该对中间行(或内部带有图像/文本列的div(或其他事情做的事情。

我需要做的就是确保如果是单个大图像、多个图像、带有图像的文本或其他组合,它始终适合顶部和底部行。即使它导致我的列分别向左或向右结束,我也没关系。

这是小提琴:https://jsfiddle.net/vbuf0gwL/62/

如果你在1457x781左右拖动结果,你真的可以看到问题,这就是为什么它在大显示器上如此糟糕的原因。

同样,顶部和底部行应始终在视图中,中间应相应地缩放

img {
max-width: 100%;
max-height: 90vh;
}
html,
body {
height: 100%;
overflow: hidden;
}
.modal-lg {
max-width: 80% !important;
}
.my-container {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.my-container>.top [class^="col-"],
.my-container>.bottom [class^="col-"] {
background-color: #929292;
color: white;
text-align: center;
}
.my-container>.middle {
flex-grow: 1;
padding: 30px;
background-size: cover;
}
.my-container>.middle>* {}
#clock {
/*background-color:#333;*/
font-family: sans-serif;
font-size: 40px;
text-shadow: 0px 0px 1px #fff;
color: #fff;
}
#clock span {
color: #fff;
font-size: 40px;
position: relative;
}
#date {
margin-top: -10px;
letter-spacing: 3px;
font-size: 20px;
font-family: arial, sans-serif;
color: #fff;
}
.buttonContainer {
display: flex;
flex-direction: column;
justify-content: center;
}
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.css" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/gijgo@1.9.6/css/gijgo.min.css" rel="stylesheet" type="text/css" />
<link href="https://rawgit.com/tempusdominus/bootstrap-4/master/build/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="src/ytv.css" type="text/css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.0/moment-with-locales.js"></script>
<script src="https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gijgo@1.9.6/js/gijgo.min.js" type="text/javascript"></script>
<script type='text/javascript' src='//cdn.jsdelivr.net/jquery.marquee/1.4.0/jquery.marquee.min.js'></script>
</head>
<body>
<div class="container-fluid my-container">
<div class="row">
<div class="col-lg-12" style="background-color:black">
<p style="color:white">
test
</p>
</div>
</div>
<div class="row middle" style="flex:1; ">
<div class="col-lg-6 leftFifty" id="leftFifty">
<div class="leftContent" style="background-color: white; border: dotted 1px black; ">
<p>TEST</p>
<img src="https://via.placeholder.com/1024x942" />
<!-- This is the div that is clicked in to select an image -->
</div>
</div>
<div class="col-lg-6 rightFifty" id="rightFifty">
<div class="rightContent" style="background-color: white; border: dotted 1px black; ">
<p>TEST</p>
<img src="https://via.placeholder.com/1024x942" />
<!-- This is the div that is clicked in to select an image -->
</div>
</div>
</div>
<div class="row ">
<div class="col-lg-12" style="background-color:black">
<p style="color:white">
test
</p>
</div>
</div>
</div>
</body>
</html>

将页眉和页脚设置为position: fixed;topbottom属性分别设置为0

最新更新