<input type="checkbox" ng-class="{disabled: vm.reportSchedule.DailyOption === false}" name="dailyRunOnDays"
ng-model="vm.reportSchedule.DailyRunOnDays[day]">
我需要总是在顶部div id =“header”,总是在buttom div class ='inputContainer'和中间(占用页面的其余部分)div class =“chatArea”没有那个div class =“ chatArea“覆盖或被div id =”header“或div class ='inputContainer'覆盖。有谁知道这样做的css代码?
答案 0 :(得分:1)
使用
flexbox
,这很容易实现。将包含3个分区的包装器设置为
display: flex;
和 给它一个100% or 100vh
的高度。包装的高度会 填满整个高度,display: flex;
将导致所有 这个包装器的子节点具有适当的flex属性 (例如flex:1;
)用flexbox-magic控制。
示例标记:
<div class="wrapper">
<header>I'm a 30px tall header</header>
<main>I'm the main-content filling the void!</main>
<footer>I'm a 30px tall footer</footer>
</div>
相关的CSS将是:
.wrapper {
height: 100vh;
display: flex;
/* Direction of the items, can be row or column */
flex-direction: column;
}
header,
footer {
height: 30px;
}
main {
flex: 1;
}
答案 1 :(得分:0)
快速谷歌搜索应该做..但你走了。一种方法。
body {
padding-top: 60px;
padding-bottom: 40px;
}
#header,
#footer {
width: 100%;
position: fixed;
background: #333;
padding: 10px 0;
color: #fff;
}
#header {
top: 0;
}
#footer {
bottom: 0;
}
.chatArea {
width: 80%;
margin: 0 auto;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chat</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="header">
<h1 id="titleRoom"></h1>
<h3>Online Users:</h3>
<div id="online_users"></div><br>
<button id="buttonRoom" type="button" name="button">Create Chatroom</button><button id="buttonLobby" type="button" name="button">Back Lobby</button>
</div>
<div class="chatArea">
<ul class="messages"></ul>
</div>
<div id="footer" class='inputContainer'>
<input class="inputMessage" placeholder="Type here..." /><button id="sendButton" type="button" name="button">Send</button>
</div>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/js/client.js"></script>
</body>
</html>
答案 2 :(得分:0)
Flexbox救援。
使用您的结构。颜色编码。
body{display:flex; flex-direction: column; height: 100vh;}
#header{height: 100px; background: green;}
.chatArea{flex-grow: 1; align-self:stretch; background: blue;}
.inputContainer{height: 100px; align-self: flex-end; width: 100%; background: red;}
&#13;
<head>
<meta charset="UTF-8">
<title>Chat</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="header">
<h1 id="titleRoom"></h1>
<h3>Online Users:</h3>
<div id="online_users"></div>
<br>
<button id="buttonRoom" type="button" name="button">Create Chatroom</button><button id="buttonLobby" type="button" name="button">Back Lobby</button>
</div>
<div class="chatArea">
<ul class="messages"></ul>
</div>
<div class='inputContainer'>
<input class="inputMessage" placeholder="Type here..." /><button id="sendButton" type="button" name="button">Send</button>
</div>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/js/client.js"></script>
</body>
&#13;
答案 3 :(得分:0)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chat</title>
<link rel="stylesheet" href="css/style.css">
<style>
boduy{
width: 100%;
height: 100%;
}
.container{
position: relative;
height: 250px;
width:400px;
border-style: dashed;
left:100px;
top:200px;
}
#header{
text-align: center;
}
#buttons{
position: relative;
text-align: center;
}
#buttonRoom {
position:relative;
border-radius: 5px;
background-color: burlywood;
}
#buttonLobby{
position:relative;
border-radius: 5px;
background-color: burlywood;
}
.inputContainer{
position:relative;
margin-top: 30px;
text-align: center;
}
#send-button{
position:relative;
margin-top: 20px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<div id="header">
<h1 id="titleRoom"></h1>
<h3>Online Users:</h3>
</div>
<div id="online_users"></div>
<div id="buttons">
<button id="buttonRoom" type="button" name="button">Create Chatroom</button><button id="buttonLobby" type="button" name="button">Back Lobby</button>
</div>
<div class='inputContainer'>
<textarea id="text-area" rows="5" cols="50" placeholder="Type here..."></textarea>
</div>
<div id="send-button">
<button id="sendButton" type="button" name="button">Send</button>
</div>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/js/client.js"></script>
</div>
</body>
</html>