您好我尝试在.chat。中设置滚动(overflow-y:scroll),我尝试每个代码但不起作用。
提前谢谢! ////////////////////////////////////////代码:
<div class="chat">
<div class="head"></div>
<div class="body">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td align="left" width="40">
<img src="http://www.exclutips.com/wp-content/uploads/2015/08/wordpress-custom-user-avatar.png" style="
width: 32px;
height: 32px;
display: block;
border: 1px solid rgba(0, 0, 0, .1);
cursor: pointer;
">
</td>
<td align="left" width="136">
<div class="user-name">User Name</div>
</td>
<td align="right">
<span class="online-icon"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="footer">
<input type="text" placeholder="Search">
</div>
</div>
<style type="text/css">
* { font-family: "Segoe UI"; }
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
height: 100%;
}
body {
margin: 0;
padding: 0;
background: #F2F2F2;
height: 100%;
}
input, select {
display: block;
width: 100%;
padding: 5px;
outline: none;
border-width: 1px;
border-style: solid;
border-radius: 0;
background: #fff;
font-size: 12px;
color: #6B6B6B;
appearance:normal;
-moz-appearance:none;
-webkit-appearance:none;
border-color: #BDBDBD;
}
div, textarea, input, select, button, a { box-sizing: border-box; -moz-box-sizing: border-box; }
.chat {
display: table;
border-left: 1px solid #ccc;
position: fixed;
height: 100%;
top: 0;
right: 0;
bottom: 0;
width: 200px;
margin: 0;
padding: 0;
background: #E1E1E1;
}
.chat .head {
display: table-row !important;
height: 52px;
}
.chat .body {
overflow-y: scroll;
display: table-row;
height: 100% !important;
}
.chat .body table {
cursor: pointer;
padding: 5px;
}
.chat .footer {
display: table-row !important;
}
</style>
答案 0 :(得分:0)
从display: table-row;
删除.chat .body
。
答案 1 :(得分:0)
将此样式用于.chat .body类,但你应该在html中复制用户表,直到它超过页面的高度,然后你就可以看到滚动来了。
.chat .body {
overflow-y: scroll;
height: 80%;
}
你应该删除display:table-row,并且高度应小于100%。
答案 2 :(得分:0)
您可以使用blocktrans
设置jQuery
身高:
.body
和jQuery
* {
box-sizing:border-box;
...
}
.chat {
display: block;
...
}
.chat .head {
height: 52px;
...
}
.chat .body {
overflow-y: auto;
...
}
请参阅完整示例here。