2011-07-14 33 views
0
<style type="text/css"> 
#left { 
float:left; 
background: red; 
width:100px; 
} 

#right { 
width:102px; 
height:102px; 
border:1px solid black; 
} 

</style> 

<div id="left"> 
<form action=""> 
    <input type="text" /> 
    <input type="text" /> 
    <input type="text" /> 
</form> 
</div> 
<div id="right"> 
<form action=""> 
    <input type="text" /> 
    <input type="text" /> 
    <input type="text" /> 
</form> 
</div> 

因此我不能有一個浮動:左工作與div中的窗體。 你有解決方案嗎?如何對齊2格與

+0

您還沒有浮動的形式。你是浮動div嗎? – Jawad

+0

是div浮動,而不是形式 – canardman

+0

究竟你想達到什麼目的 - http://jsfiddle.net/j53cH/ – Jawad

回答

1

浮點#right。

body { 
    width: 202px; 
    } 

    #left { 
    float:left; 
    background: red; 
    width:100px; 
    } 

    #right { 
    width:102px; 
    height:102px; 
    border:1px solid black; 
    float: right; 
    } 

    </style> 
    <body> 
    <div id="left"> 
    <form action=""> 
     <input type="text" /> 
     <input type="text" /> 
     <input type="text" /> 
    </form> 
    </div> 
    <div id="right"> 
    <form action=""> 
     <input type="text" /> 
     <input type="text" /> 
     <input type="text" /> 
    </form> 
    </div> 
    </body> 
+0

似乎不工作 – canardman

+0

使身體寬度變寬或完全刪除它然後 - http://jsfiddle.net/PeQbE/ – Catfish

0

嘗試包裹都格在同一個父格,然後浮動:

<style type="text/css"> 
#left { 
float:left; 
background: red; 
width:100px; 
} 

#right { 
float: right; 
width:102px; 
height:102px; 
border:1px solid black; 
} 

</style> 

<div> 
    <div id="left"> 
    <form action=""> 
     <input type="text" /> 
     <input type="text" /> 
     <input type="text" /> 
    </form> 
    </div> 
    <div id="right"> 
    <form action=""> 
     <input type="text" /> 
     <input type="text" /> 
     <input type="text" /> 
    </form> 
    </div> 
</div>