简体   繁体   English

CSS:溢出动态创建的内容

[英]CSS : Overflowing Dynamically Created Content

I'm trying to dynamically update elements initially with a layout like this: 我试图用这样的布局动态更新元素:

在此输入图像描述

Now, the application involves interaction which some button to update the contents of the Small Content division : 现在,该应用程序涉及交互,其中一些按钮用于更新Small Content部门的内容

script upon button click: 单击按钮时的脚本:

$.ajax({    //some ajax request upon button click
      success: function(result){
      $('#small-content').append(result);
      }
});

What this is doing is upon a button click, a request is made and the results are dynamically added to the #small-content div, but it results to this : 这样做是通过单击按钮,发出请求并将结果动态添加到#small-content div,但结果如下:

在此输入图像描述

How do I fix this in such a way that it pushes the footer down rather than overlapping it? 我如何解决这个问题,以便将页脚向下推而不是重叠? Note that I cannot in anyway modify the footer's css since it was rendered globally. 请注意,我无法修改页脚的css,因为它是全局呈现的。

I think you will fix your layout if you add additional block after #small-content with the size that the same as #footer. 如果您在#small-content之后添加额外的块,其大小与#footer相同,我认为您将修复您的布局。 But it will work only if footer has fixed size . 但只有当页脚具有固定大小时才会起作用

Something like this 像这样的东西

<div id="small-content"><!-- some content --></div>
<div id="footer-separator" class="footer-separator"><!-- empty block --></div>
<div id="footer" class="footer"><!-- some content --></div>

And styles 和风格

.footer-separator {
   height: 100px; 
   ....
}

.footer {
   height: 100px; 
   ....
}

Try adding the margin-top property to #footer. 尝试将margin-top属性添加到#footer。 So this will maintain the spacing between #small-content and #footer in all cases. 因此,在所有情况下,这将保持#small-content和#footer之间的间距。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM