Home  >  Article  >  Web Front-end  >  div位置不对_html/css_WEB-ITnose

div位置不对_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:16:291268browse

我本意打算上边两个并排,第三个在下边 


    
左侧部分

        
右侧部分

        
政策法规和采购指南两个板块

    


div.main-body{
width:900px;
height:900px;
background:#000;
margin:0px auto;
padding:0;
}

div.left{
width:600px;
height:600px;
background:#00F;
float:left;
margin-left:0px;
}

显示的时候,第一个在距离左边的时候总是有一段距离,以至于第二个放不下,然后显示在下边去了

回复讨论(解决方案)


蓝色部分就是left,黑色部分就是mian-body。蓝色不应该在左边么?????

你为什么不用表格控制版面,div嵌入到表格内

<!DOCTYPE html><html><head><style>* {margin:0px;padding:0px}#page {width:900px;background:#ccc;margin:100px auto;}#left {width:450px;height:50px;background:blue;float:left;}#right {width:450px;height:50px;background:red;float:left;}#down {width:900px;background:green;height:50px;float:left;}</style></head><body><div id="page"><div id="left">left</div><div id="right">right</div><div id="down">down</div></div></body></html>

div.main-body{width:900px;height:900px;background:#6F9;margin:0px auto;padding:0;}div.left{width:600px;height:600px;background:#00F;float:left;margin-left:0px;}div.right{width:300px;height:600px;background:red;float:left;margin-left:0px;}

css第一步 reset一下

遇到排版和位置问题时建议统一absolute,最后包一个relative,这样是最轻松最直观的,只用top,left,right,bottom:就可以。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn