我正在尝试在我的页面上运行滚动条。当我添加overflow-y时:滚动。它使div部分内的内容完全消失。 我目前在div部分中使用的CSS是:overflow-y:scroll,height:100%。我错过了什么吗?
<div id = "section">
<div id = "map">
<h1 align = "center">Find Us!</h1>
<div id = "map-canvas"></div>
<p>
</p>
</div>
<div id = "form">
<form method="post" action="mailto: jbloggs@ait.ie">
<fieldset>
<h1 align="center">Contact Us</h1>
<table class="contacttable">
<tr align="left" valign="middle">
<td>First Name</td>
<td><input type="text" name="firstname"/></td>
</tr>
<tr align="left" valign="middle">
<td>Surname</td>
<td><input type="text" name="lastname"/></td>
</tr>
<tr>
<td>Address Line 1</td>
<td><input type="text" name="addressline1"/></td>
</tr>
<tr>
<td>Address Line 2</td>
<td><input type="text" name="addressline2"/></td>
</tr>
<tr>
<td>Town</td>
<td><input type="text" name="town"/></td>
</tr>
<tr>
<td>County</td>
<td><input type="text" name="county"/></td>
</tr>
<tr align="left" valign="middle">
<td><input type="radio" name="sex" value="male"/>Male</td>
<td><input type="radio" name="sex" value="female"/>Female</td>
</tr>
<tr>
<td>Date of Birth</td>
<td><input type="text" name="dob"/></td>
</tr>
</table>
</fieldset>
</form>
</div>
</div>
答案 0 :(得分:1)
#section {
max-height: 150px; /*add height as you want*/
overflow-y: auto;
}
完成此http://www.w3schools.com/cssref/pr_pos_overflow.asp
Is there a way to set vertical scrollbar for a div?
这可能对您有所帮助:)。