2013-10-07 22 views
0

有人可以幫助我在同一行上有兩個輸入字段和一個提交按鈕嗎?我已經在jsfiddle中創建了示例。謝謝。輸入文件在oneline

http://jsfiddle.net/Mndgw/

<div class="row"> 
     <div class="col-lg-4 col-lg-offset-4"> 
      <div class="form-group"> 
       <input name="Test1" type="text" class="form-control" id="test1" > 
       <input name="Test2" type="text" class="form-control" id="test2" > 
       <button name="TestSubmit" type="submit" class="btn btn-primary" >Submit</button>      
      </div>   
    </div> <!-- col-lg-4 col close --> 
    </div> <!-- row close --> 

回答

0

http://jsfiddle.net/Mndgw/1/ 一般來說:爲了放置幾個div的在一行中,它們都應該有具有顯示的容器:內聯塊,和一個數字寬度(PX \%)的寬度,和他們每個人都應該有CSS屬性顯示:inline-block的,用數字寬度(PX \ precent)沿 HI我已經更新了你的代碼,請查看小提琴

@import url('https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css'); 
.myField{ 
    width:39%; 
    display:inline-block; 

} 
.mySubmit{ 
    width:19%; 
    display: inline block; 
} 
.myContainer{ 
    width: 70%; 
    margin: auto; 
    text-align: center; 
} 

-

<div class="row"> 
     <div class="col-lg-4 col-lg-offset-4"> 
      <div class="form-group myContainer"> 
       <input name="Test1" type="text" class="form-control myField" id="test1" > 
       <input name="Test2" type="text" class="form-control myField" id="test2" > 
       <button name="TestSubmit" type="submit" class="btn btn-primary mySubmit" >Submit</button>     
      </div>   
    </div> <!-- col-lg-4 col close --> 
    </div> <!-- row close --> 
+0

謝謝!相反,明確添加更多的樣式,甘蔗我們使用引導預定義的CSS。在我的形式Casue,稍後如果我添加另一個文本字段和標籤他們看起來不對齊。 http://jsfiddle.net/Mndgw/2/。 – user2088016

+0

引導程序沒有block \ inline-block顯示css屬性的類,但可以創建一個類並將其與引導類一起使用。 –