製作
使用 Bootstrap 左對齊


在 Bootstrap 中使用 .form-inline 類讓 <form> 左對齊。

你可以嘗試執行以下程式碼來實現 .form-inline 類

示例

即時演示

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <form class = "form-inline" role = "form">
         <div class = "form-group">
            <label class = "sr-only" for = "name">Name</label>
            <input type = "text" class = "form-control" id = "name" placeholder = "Enter Player Name">
         </div>
         <div class = "form-group">
            <label class = "sr-only" for = "name">Name</label>
            <input type = "text" class = "form-control" id = "name" placeholder = "Enter Player Country">
         </div>
         <button type = "submit" class = "btn btn-primary">Submit</button>
      </form>
   </body>
</html>

更新時間: 12-06-2020

3 千+ 次瀏覽

開啟你的 職業生涯

完成課程即可獲得認證

立即開始
廣告