简体   繁体   English

CSS 分页:左侧展开导致浮动向下移动

[英]CSS split page: left side expansion causes float to move down

<div id="left" style="float:left; width=20%"></div>
<div id="right" style="float:right"/>

I am loading 2 pages using jquery to above div's.我正在使用 jquery 将 2 个页面加载到 div 上方。 when the page in left is expanded due to its content, the right side div is getting down/moving.当左侧的页面由于其内容而展开时,右侧的 div 向下/移动。 any way to keep the right side not changed?有什么办法可以保持右侧不变?

You need this: https://jsfiddle.net/56ocrp17/你需要这个: https : //jsfiddle.net/56ocrp17/

#left {
  float:left;
  width:20%;
}

#right {
  width:80%;
  float:left;
}

You need to specify a width for the right side element.您需要为右侧元素指定宽度。 It works when both have float:left;当两者都具有float:left;时它起作用float:left; too.也。

Try using尝试使用

clear:both;

You can find more about it here: http://www.w3schools.com/cssref/pr_class_clear.asp您可以在此处找到更多相关信息: http : //www.w3schools.com/cssref/pr_class_clear.asp

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

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