<style type="text/css">
#left {
float:left;
background: red;
width:10开发者_开发问答0px;
}
#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>
So i can't have a float:left worked with forms in the div. Do you have a solution ?
Float the #right as well.
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>
Try wrapping both div's in the same parent div and then floating:
<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>
精彩评论