Bootstrap系列 -- 14. 表單控制元件輸入框input

賀臣發表於2015-06-24

 

  

  每一個表單都是由表單控制元件組成。離開了控制元件,表單就失去了意義。接下來的我們簡單的來了解Bootstrap框架中表單控制元件的相關知識。

  單行輸入框,常見的文字輸入框,也就是inputtype屬性值為text。在Bootstrap中使用input時也必須新增type型別,如果沒有指定type型別,將無法得到正確的樣式,因為Bootstrap框架都是通過input[type=“?”](其中?號代表type型別,比如說text型別,對應的是input[type=“text”])的形式來定義樣式的。

<form role="form">
  <div class="form-group">
    <input type="email" class="form-control" placeholder="Enter email">
    
  </div>
  
  <div class="form-group">
    <input type="text" class="form-control" placeholder="請輸入使用者名稱">
    
  </div>
</form>   

 

相關文章