【发布时间】:2018-06-11 18:08:16
【问题描述】:
您好,我有一个父 div main-section 和两个子 div leftContent 和 rightContent,它们彼此相邻。
我希望孩子的身高与父母的身高相同。另外,我希望main-section 占据页面中的所有垂直空间,以防main-section 中的内容不多。这意味着如果内容不足,页脚将始终保留在页面底部。
我的代码适用于 Chrome、Safari 和 firefox,但不适用于 IE 11。
JS 小提琴 - https://jsfiddle.net/2qbw21xk/
这是预期的 -
这就是在 IE 中发生的事情
请帮忙!
提前致谢!
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>XXXXXXXXX</title>
<meta name="description" content="XXXXXXXXXXXXXXXXX">
<meta name="author" content="XXXXXXXXXXXXXXXXXXXX">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
</head>
<style>
/*----------GLOBAL-------*/
.container{
width: 97%;
margin: auto;
overflow: hidden;
}
.centerAlign{
text-align: center;
}
/*----------HEADER-------*/
header{
height: 102px;
}
header div img{
top: 6px;
position: relative;
}
.logo_mobile {
display: none;
}
@media only screen and (max-width: 1100px) {
.logo_mobile {
display: inline;
position: relative;
top: 25px;
}
.logo_desktop {
display:none;
}
}
/*----------TOPNAV-------*/
nav {
background-color: #182d3c;
color: #fff;
height: 50px;
border-bottom: 4px solid #ffd100 !important;
}
nav div ul li{
display:inline;
}
.navContent{
position: relative;
top: 6%;
height: inherit;
}
/*----------MAIN BODY-------*/
html,
body {
height: 100%;
overflow-x: hidden;
}
.main-section{
min-height: calc(100% - 291px);
min-height: -webkit-calc(100% - 291px);
display: flex;
}
.header{
border-bottom: 1px solid #e8e8e8;
}
.question{
}
.buttons{/* border-top: 1px solid #e8e8e8; */}
/*---------------RIGHT CONTENT---------------*/
.rightContent{
overflow: hidden;
border-left: 1px solid #e8e8e8;
flex:2;
}
/*----LEFT CONTENT---*/
.leftContent{
float:left;
flex:7;
}
.header{
}
.buttons{
}
.question{
}
/*----------Footer------*/
footer{
clear: both;
position: relative;
background-color: #e9eef2;
min-height: 135px;
width: 100%;
text-align: center;
}
.footerHead{
font-weight:400;
font-size: 20px;
color: #606d75;
}
/*-----HAMBURGER_____*/
#hamburger_icon{
float:left;
height:22px;
width: 22px;
display: none;
}
/*----RIGHT PANEL MOBILE-----*/
@media only screen and (max-width: 1100px) {
.leftContent{
width:100%;
}
.rightContent{
display:none;}
}
</style>
<body>
<header>
<div class="container centerAlign">
<img>
</div>
</header>
<nav>
<div class="container centerAlign navContent">
<img src="hamburger.png" id="hamburger_icon">
<ul>
<li>XXX</li>
<li>XXX</li>
<li>XXX</li>
</ul>
</div>
</nav>
<section class="main-section">
<div class="leftContent">
<div class="header" id="innerPageHeadingWrap">
<P>TITLE SECTION</P>
</div>
<div class="question">
<P>QUESTION SECTION</P>
</div>
<div class="buttons">BUTTON SECTION
</div>
</div>
<div class="rightContent">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</section>
<footer>
<div class="footerContent container centerAlign">
<p>sdf sdfsdfsd fdsfsd fsd fsd f sd f sdf sd fsd f dsfsd</p>
<p>sdf sdfsdfsd fdsfsd fsd fsd f sd f sdf sd fsd f dsfsd</p>
</div>
</footer>
</body>
</html>
【问题讨论】:
标签: html css internet-explorer flexbox