没有通过另一个DIV漂浮左

时间:2013-10-28 12:39:44

标签: html css css-float

我正在尝试在我的网站上添加侧边栏。 我一直在尝试使用以下代码创建一个将用作菜单的div

      <div style="">
          <div style="display:inline;width:70%;">
                hey
           </div>
           <div style="float:left;width:20%;">
               <div style="background-color:#F2F2F2;font-weight:bold;padding:7px;">Title</div>
               text<br /><br />f
           </div>
       </div>

然后,我得到了以下结果:

enter image description here

侧边栏会经过另一个div,而不会作为个人div发挥作用。

1 个答案:

答案 0 :(得分:0)

您需要清除浮动以解决此问题。

对于实例,在您的情况下,

<div style="clear:left;">&nbsp;</div>
相关问题