gpt4 book ai didi

html - 在 Div 内的段落中添加垂直滚动条

转载 作者:太空宇宙 更新时间:2023-11-04 13:46:50 24 4
gpt4 key购买 nike

我在 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 内的段落中获得垂直滚动条...请帮我 ..提前致谢..

最佳答案

简短快速的回答,通过将 overflow-y 添加到 style 属性,将滚动条添加到 #bodydesc:

<div id="bodydesc" style="margin-left:auto; margin-right:auto; width:960px; height: 600px; overflow-y: scroll;">

<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>

我的前端开发人员坚持要我告诉你将所有这些样式声明移动到 external css file 中.

关于html - 在 Div 内的段落中添加垂直滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24185558/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com