2013-05-04 59 views
0

我無法正確地對齊輸入元素和按鈕。這是什麼樣子:引導程序中輸入元素的邊距和對齊

Notice the bottom alignment of button and input

這來自於下面的代碼:

<div class="row"> 
    <div class="offset1 span6"> 
      <input type="text" class="l_input" placeholder="enter a city"></input> 
    </div> 
    <div class="span3"> 
      <button class="l_button btn btn-primary" type="button">Search</button> 
    </div> 
</div> 

我想輸入的高度是一樣的按鈕,這是不是這種情況目前。我認爲這是因爲margin/padding,所以我試圖在css中將它們設置爲0 px:但它沒有影響。

.l_input { 
padding: 0px; 
margin: 0px; 
} 

我需要怎麼做才能使輸入的高度與搜索按鈕的高度一致?

+1

嘗試很重要!爲什麼? – 2013-05-04 16:25:44

+0

這裏有點問題:''。關閉標記 – WooCaSh 2013-05-04 16:30:45

+0

感謝您指出 - 這是一個錯字,我將編輯問題 – 2013-05-04 16:39:32

回答

0

你幾乎是正確的,但邊距和填充是在另一個元素。嘗試:

.l_input, 
.l_button { 
    padding: 0px; 
    margin: 0px; 
} 

updated demo