我一直在試圖使兩個下拉列表並排顯示,但無法弄清楚。什麼CSS元素屬性設置來做到這一點。我必須表明它的格式如下:的我如何得到兩個下拉列表並排顯示?
[company] [mobile]
代替
[company]
[mobile]
有3個這樣的對。此外,這對2個選擇的下拉框似乎並不堅持其劃分。
<html>
<head>
<style>
body
{
background-image:url('gradient1.jpg');
background-repeat:repeat-x;
}
.ex
{
margin:auto;
width:90%;
padding:10px;
border:outset;
}
select
{
display:inline;
cursor:pointer;
}
.ey
{
display:inline;
}
.gap
{
clear:both;
margin-bottom:2px;
}
</style>
</head>
<body>
<div class="ex">
<form id='dd1.mob1' name='dd1.mob1' method='post' action=' '>
<p><label>Select Company</label></p><br/>
<select onchange=filter.submit() name='dd1mob1' id='dd1mob1'>
<option>1</option>
<option>2</option>" . $options . "
</select>
</form>
<form class="ey" id='dd2.mob1' name='dd2.mob1' method='post' action=''>
<p><label>Select Mobile</label></p><br/>
<select onchange=filter.submit() name='dd2mob1' id='dd2mob1'>
" . $options . "
</select>
</form>
</div>
<div class="ex" class="gap" >
<form id='dd1.mob2' name='dd1.mob2' method='post' action=' '>
<p><label>Select Company</label></p><br/>
<select onchange=filter.submit() name='dd1mob2' id='dd1mob2'>
<option>1</option>
<option>2</option>" . $options . "
</select>
</form>
<form class="ey" id='dd2.mob2' name='dd2.mob2' method='post' action=''>
<p><label>Select Mobile</label></p><br/>
<select onchange=filter.submit() name='dd2mob2' id='dd2mob2'>
" . $options . "
</select>
</form>
</div>
<div class="ex" class="gap">
<form id='dd1.mob3' name='dd1.mob3' method='post' action=' '>
<p><label>Select Company</label></p><br/>
<select onchange=filter.submit() name='dd1mob3' id='dd1mob3'>
<option>1</option>
<option>2</option>" . $options . "
</select>
</form>
<form class="ey" id='dd2.mob3' name='dd2.mob3' method='post' action=''>
<p><label>Select Mobile</label></p><br/>
<select onchange=filter.submit() name='dd2mob3' id='dd2mob3'>
" . $options . "
</select>
</form>
</div>
</body>
</html>
一個很好的解釋你確定,你需要一種形式爲每個選擇元素?使用float:left樣式的塊,如果你想要內聯,並且使用br clear =「both」的塊來停止浮動 – Eugene 2013-05-07 17:04:01
我會認爲有很多表單元素會對目標css有很多問題尋找你想要什麼。 – Justin 2013-05-07 17:06:25
@Eugene:我添加了一個.gap類,並添加到所有的div元素,這是你的意思?由於第二個下拉列表的值取決於1st的值,因此我使用了單獨的窗體。 – 2013-05-07 17:15:23