5

登録用に2つのフォームを作成しました。以下のコードをページに追加すると、2 番目のフィールドが最初のフィールドの下に自動的にドロップダウンします。それ以外にも行きたいと思います。

<h1>Register</h1>


<input type="text" class="form-control" placeholder="Forename" autofocus style="width:150px">
<input type="text" class="form-control" placeholder="Surname" autofocus style="width:150px">

これは、通常のhtml(現在)でどのように見えるかの例であり、それが私が望むものです。しかし、ブートストラップでは、新しい行を取り続けます

4

1 に答える 1

8

Bootstrap のサイトでインライン フォーム スタイルを参照してください。

<form class="form-inline" role="form">
  <div class="form-group">
    <label class="sr-only" for="exampleInputEmail2">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email">
  </div>
  <div class="form-group">
    <label class="sr-only" for="exampleInputPassword2">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password">
  </div>
</form>

または、列を使用してフォーム要素を隣り合わせに配置することもできます。

<div class="row">
  <div class="col-lg-2">
    <input type="text" class="form-control" placeholder=".col-lg-2">
  </div>
  <div class="col-lg-3">
    <input type="text" class="form-control" placeholder=".col-lg-3">
  </div>
  <div class="col-lg-4">
    <input type="text" class="form-control" placeholder=".col-lg-4">
  </div>
</div>
于 2013-09-30T08:45:56.233 に答える