我在 Div 中有一个段落。现在该段落的内容越来越多,因为我计划添加一些图像,但我的 div 的固定高度为 600px;
所以我的段落所以如果垂直滚动条被添加对于我的段落,它将解决我的问题..
这是我的布局的 HTML ..
<div id="bodydesc" style="margin-left:auto; margin-right:auto; width:960px; height: 600px;">
<p id="desc" style="float:left;color: #666666; width:700px; font-family: Candara,Trebuchet MS,sans-serif; font-size: 12px; font-weight: bold; border-right: thin dotted #666666; line-height: 18px;">
//Here is my large content with images...
</p>
</div>
所以我的问题是如何在 HTML 的 div 内的段落中获得垂直滚动条…请帮助我..提前致谢..
原文由 user3725571 发布,翻译遵循 CC BY-SA 4.0 许可协议
简短快速的回答,通过将
overflow-y
添加到 style 属性,将滚动条添加到#bodydesc
--- :我的前端开发人员坚持要我告诉你将所有这些样式声明移动到 外部 css 文件 中。