我最近在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;
,top
和bottom
属性分别设置为0
。