2010-10-24 70 views
0

我需要这两个div看起来像是一排桌子,但是不会在旁边显示一个。任何帮助?Divs定位问题

<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <title>Info-Stanković Inženjering</title> 

     <style type="text/css"> 
      div#wrapper{ 
       width:1004px; 
       width:602px; 
       margin-left: auto; 
       margin-right: auto; 
      } 

      div#left{ 
       border-bottom: 1px solid #606060; 
       border-left: 1px solid #606060; 
       border-top:1px solid #606060; 
       width:640px; 
       height:600px; 
       min-width: 640px; 
       min-height: 600px; 
      } 

      div#right{ 
       border-bottom: 1px dashed #FF2A2A; 
       border-left: 1px dashed #FF2A2A; 
       border-right: 1px dashed #FF2A2A; 
       border-top:1px dashed #FF2A2A; 
       margin-left:643px; 
       width:360px; 
       min-width:360px; 
       height: 600px; 
       min-height: 600px; 
       float:left; 

      } 


     </style> 
    </head> 
    <body> 
     <div id="wrapper"> 
      <div id="left"> 

      </div> 
      <div id="right"> 

      </div> 
     </div> 
    </body> 
</html> 
+0

我看到一些问题:你已经为'#wrapper'指定了两个不同的宽度,而'#right'是''left''float' ed'left'。此外,请确保内部div的宽度小于或等于外部div的宽度。 – Chetan 2010-10-24 21:26:07

回答

0

尝试#wrapper

设置overflow: auto要找出原因,看一下答案,我的问题在这里: Why does setting overflow alter layout of child elements?

+0

不起作用。它在底部添加滑块,但div仍然不在同一行中。 – Rebecca 2010-10-24 21:27:54

+1

'#left'也应该是'float:left' – 2010-10-24 21:28:30

0

的浮动:左应放在DIV#没有留下DIV#权

+0

您可以通过用反引号将它们包围起来来格式化内联代码块。 – 2010-10-24 21:31:56

0

div#left仍然需要“float:left”,因为div标签是一个块元素,它不允许其他元素围绕它。