使用CSS垂直拆分页面 [英] Split page vertically using CSS

查看:503
本文介绍了使用CSS垂直拆分页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于真正简单的问题,我很抱歉,但我试图沿这些线向左和向右浮动一个预定义的宽度

 < div style =width:100%;> 
< div style =float:left; width:80%>
< / div>
< div style =float:right;>
< / div>
< / div>

虽然这个大多数的工作似乎弄乱了下面的页面上的其他元素。 / p>

那么什么是正确的为什么使用CSS垂直拆分为两个部分,而不影响页面上的其他元素?

解决方案

您可以使用..

 < div style = :100%;> 
< div style =float:left; width:80%>
< / div>
< div style =float:right;>
< / div>
< / div>
< div style =clear:both>< / div>

现在的元素不会受到影响。


Sorry guys for the really simple question but I have tried to float one div left and one right with predefined widths along these lines

<div style="width: 100%;">
    <div style="float:left; width: 80%">
    </div>
    <div style="float:right;">
    </div>
</div>

Although this 'mostly' works it seems to mess up the other elements on the page below it.

So what is the correct why to split a HTML page vertically into two parts using CSS without effecting other elements on the page?

解决方案

you can use..

<div style="width: 100%;">
   <div style="float:left; width: 80%">
   </div>
   <div style="float:right;">
   </div>
</div>
<div style="clear:both"></div>

now element below this will not be affected.

这篇关于使用CSS垂直拆分页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆