부트스트랩 CSS 양식 참조


부트스트랩의 기본 설정

개별 양식 컨트롤은 Bootstrap을 사용하여 일부 전역 스타일을 자동으로 받습니다.

class="form-control"인 모든 텍스트 <input>, <textarea> 및 <select> 요소는 width: 100%로 설정됩니다. 기본적으로.

세 가지 양식 레이아웃 모두에 대한 표준 규칙:

  • 랩 레이블 및 양식 컨트롤 <div class="form-group">(최적의 간격에 필요)
  • .form-control모든 텍스트 <input>, <textarea><select>요소 에 클래스 추가

다음 예제는 두 개의 입력 필드, 하나의 확인란 및 제출 버튼이 있는 간단한 부트스트랩 양식을 만듭니다.

부트스트랩 양식 예

<form>
  <div class="form-group">
    <label for="email">Email address:</label>
    <input type="email" class="form-control" id="email">
  </div>
  <div class="form-group">
    <label for="pwd">Password:</label>
    <input type="password" class="form-control" id="pwd">
  </div>
  <div class="checkbox">
    <label><input type="checkbox"> Remember me</label>
  </div>
  <button type="submit" class="btn btn-default">Submit</button>
</form>

양식 클래스

Class Description Example
.form-inline Makes a <form> left-aligned with inline-block controls (This only applies to forms within viewports that are at least 768px wide)
.form-horizontal Aligns labels and groups of form controls in a horizontal layout
.form-control Used on input, textarea, and select elements to span the entire width of the page and make them responsive
.form-control-feedback Form validation class
.form-control-static Adds plain text next to a form label within a horizontal form
.form-group Container for form input and label

입력 클래스

Class Description Example
.input-group Container to enhance an input by adding an icon, text or a button in front or behind it as a "help text"
.input-group-lg Large input group
.input-group-sm Small input group
.input-group-addon Together with the .input-group class, this class makes it possible to add an icon or help text next to the input field
.input-group-btn Together with the .input-group class, this class attaches a button next to an input. Often used as a search bar
.input-lg Large input field
.input-sm Small input field