Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 带有溢出-y的段落:滚动正在替换我的下方Div_Html_Css - Fatal编程技术网

Html 带有溢出-y的段落:滚动正在替换我的下方Div

Html 带有溢出-y的段落:滚动正在替换我的下方Div,html,css,Html,Css,我在一个Div中有一个段落。我已经固定了段落的宽度和高度以及这个属性overflow-y:scroll。我的段落可以垂直滚动。但是它正在替换我下面的Div 这是HTML <div id="bodydesc" style="margin-left:auto; margin-right:auto; width:960px; height: 600px;"> <p id="desc" style="float:left;overflow-y: scroll;color: #

我在一个Div中有一个段落。我已经固定了段落的宽度和高度以及这个属性
overflow-y:scroll
。我的段落可以垂直滚动。但是它正在替换我下面的Div

这是HTML

<div id="bodydesc" style="margin-left:auto; margin-right:auto; width:960px; height: 600px;">
    <p id="desc"  style="float:left;overflow-y: scroll;color: #666666;height:590px; width:700px; font-family: Candara,Trebuchet MS,sans-serif; font-size: 12px; font-weight: bold; border-right: thin dotted #666666; line-height: 18px;"></p>
</div>

<div id="footer" class="footer-shadow">
    <div style="margin-left:auto; margin-right:auto; width:960px; "></div>
</div> 
我的这个Div
正在下降意味着从原来的位置移动


请帮帮我。

我将从检查html语法开始。首先确保您的html是正确的,并且正确地关闭和打开了
标记


检查完后,我认为您需要将
float:left
添加到
.footer shadow
样式中。如果没有它,我认为它正在将html包装到下一行

您需要为包含
overflow-y
属性的div指定一个固定大小(以像素为单位)。

如果可能,请提供您的代码演示。你可以用。这将有助于理解您的问题。您应该将css与html分开使用,这里有一个礼物:我检查了,根据我的理解,它对我的答案的OKSee修正案,我还建议将您的样式保留在样式表中,如果您能帮助的话,不要使用内嵌元素样式。这使得在出现问题时更难管理和调试
.footer-shadow{
    background-image: url('../img/new_images/footer-bg.jpg');
    height: 170px;
    width: 100%;
    color: gray;
}