2012-09-28 109 views
0

我有一個帶有文本輸入框的字段集,帶有一個提交按鈕。我希望它們出現在單行中,但字段集出現在一行中,然後繼續出現在下一行中。這裏是我的html:HTML顯示字段和按鈕嵌入

<label><fieldset class="registration_code"> 
    <legend>Registration Code</legend> 
    <input type="text" name="regis_code" id="regis_code"/> 
</fieldset> 
    <input type="button" class="button2" name="Submit" value="Continue"/> 
</label> 

我試圖使按鈕或字段集內聯,內聯塊,浮的所有組合:左,浮動:正確的。他們中沒有一個導致我想要的。我只想要一行顯示這兩個元素。我如何去做這件事?

回答

2

不知道爲什麼你包裹在一個標籤標記代碼:

http://jsfiddle.net/hyxaK/1/

<fieldset class="registration_code"> 
    <legend>Registration Code</legend> 
    <input type="text" name="regis_code" id="regis_code"/> 
</fieldset> 
<input type="button" class="button2" name="Submit" value="Continue"/> 

.registration_code { display:inline-block; } 
0

要麼你能做到這一點,

<label> 
    <fieldset class="registration_code"> 
    <legend>Registration Code</legend> 
    <input type="text" name="regis_code" id="regis_code"/>  
    <input type="button" class="button2" name="Submit" value="Continue"/> 
    </fieldset> 
</label>​ 

或此,

fieldset{ 
    display : inline-block; 
}​ 

DEMO