左/右分区 [英] Left/Right Div's
问题描述
大家好,
我以前做过这个,但我不知道为什么它不会工作。如果您有任何人可以看到我的问题,请告诉我。以下是相关的代码片段。
[HTML]<! - 主要内容 - >
< div class =" main_content" ;>
<! - 内容 - >
< div class =" content">
< p>主要内容< / p>
< / div> <! - 内容结束 - >
<! - 边栏 - >
< div class =" side_bar">
< p> side content< / p>
< / div> <! - 补充工具栏结束 - >
< / div> <! - 主要内容结束 - >
[/ HTML]
将 float:right 添加到内容,将 float:left 添加到侧栏。不需要 left:0px 和 right:0px 。 (除非提供位置,否则不会工作)
PS:600 + 200 = 800,1000 - 800 = 200.你在浪费200px这是什么?
将 float:right 提供给内容,将 float:left 提供给侧边栏。不需要 left:0px 和 right:0px 。 (除非提供位置,否则不会工作)
PS:600 + 200 = 800,1000 - 800 = 200.你在浪费200px这是什么?
大声笑,忘记改回来。那应该是800和200 = 1000.我只是想让它上班。
FLOAT !!! hsriat,谢谢堆。我完全忘了漂浮,不知道我以前是怎么做的,但就是这样!问题解决了。
lol,忘了把它改回来。那应该是800和200 = 1000.我只是想让它上班。
FLOAT !!! hsriat,谢谢堆。我完全忘了漂浮,不知道我以前是怎么做的,但就是这样!问题解决了。
欢迎您。 :)
您可以位置:绝对和左:0px 和右:0px ,但如果客户的屏幕宽度超过1000px,那最终会在两个div之间留下一个空的空间。
所以要做一个流体或 liquid 页面,除左,右和位置外,您总是可以给出宽度:80%,宽度:20%。
Hi guys,
I have done this before, but I can''t figure out why it won''t work. If any of you can see my problem, please let me know. Here are the relavent pieces of code.
[HTML]<!-- Main Content -->
<div class="main_content">
<!-- Content -->
<div class="content">
<p>main content</p>
</div> <!-- End of Content -->
<!-- Side Bar -->
<div class="side_bar">
<p>side content</p>
</div> <!-- End of Sidebar -->
</div> <!-- End of Main Content -->
[/HTML]
Give float:right to content and float:left to side bar. No need of left:0px and right:0px though. (That won''t work unless position provided)
PS: 600 + 200 = 800, 1000 - 800 = 200. What are you wasting this 200px?
Give float:right to content and float:left to side bar. No need of left:0px and right:0px though. (That won''t work unless position provided)
PS: 600 + 200 = 800, 1000 - 800 = 200. What are you wasting this 200px?lol, forgot to change it back. That was supposed to be 800 and 200 = 1000. I was just trying to get it to work.
FLOAT!!! hsriat, thanks heaps. I totally forgot about float and couldn''t understand how I used to do it, but that was it! Problem solved.
lol, forgot to change it back. That was supposed to be 800 and 200 = 1000. I was just trying to get it to work.
FLOAT!!! hsriat, thanks heaps. I totally forgot about float and couldn''t understand how I used to do it, but that was it! Problem solved.You are welcome. :)
You could do position:absolute along with left:0px and right:0px, but that would end up leaving an empty space in between both of the divs if client''s screen is more then 1000px wide.
So to make a fluid or liquid page, you can always give width:80%, width:20% apart from left, right and position.
这篇关于左/右分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!