Bootstrap hỗ trợ tất cả các loại đầu vào HTML5. văn bản, mật khẩu, ngày giờ, datetime-local, ngày, tháng, thời gian, tuần, số, email, url, tìm kiếm, điện thoại và màu sắc
Ghi chú. Đầu vào sẽ KHÔNG được tạo kiểu đầy đủ nếu loại của chúng không được khai báo đúng
Ví dụ sau chứa ba nút radio. Tùy chọn đầu tiên được chọn theo mặc định và tùy chọn cuối cùng bị tắt
Bootstrap hỗ trợ tất cả các loại đầu vào HTML5. văn bản, mật khẩu, ngày giờ, datetime-local, ngày, tháng, thời gian, tuần, số, email, url, tìm kiếm, điện thoại và màu sắc
Ghi chú. Đầu vào sẽ KHÔNG được tạo kiểu đầy đủ nếu loại của chúng không được khai báo đúng
Ví dụ sau chứa hai yếu tố đầu vào; . Như chúng tôi đã đề cập trong chương Biểu mẫu, chúng tôi sử dụng lớp .form-control
để định kiểu đầu vào với độ rộng đầy đủ và phần đệm phù hợp, v.v.
Thí dụ
Tên.
Mật khẩu.
Bootstrap Textarea
Ví dụ sau chứa một vùng văn bản
Thí dụ
Nhận xét.
Hộp kiểm Bootstrap
Các hộp kiểm được sử dụng nếu bạn muốn người dùng chọn bất kỳ số lượng tùy chọn nào từ danh sách các tùy chọn đặt trước
Ví dụ sau có ba hộp kiểm. Tùy chọn cuối cùng bị vô hiệu hóa
Thí dụ
Tùy chọn 1
Tùy chọn 2
Tùy chọn 3
Ví dụ giải thích
Sử dụng phần tử bao bọc có class="form-check"
để đảm bảo lề thích hợp cho nhãn và hộp kiểm
Thêm lớp .form-check-label
vào các phần tử nhãn và hộp kiểm .form-check-input
vào kiểu đúng cách bên trong vùng chứa .form-check
Hộp kiểm nội tuyến
Sử dụng lớp .form-check-inline
nếu bạn muốn các hộp kiểm xuất hiện trên cùng một dòng
Thí dụ
Tùy chọn 1
Tùy chọn 2
Tùy chọn 3
Nút radio Bootstrap
Các nút radio được sử dụng nếu bạn muốn giới hạn người dùng chỉ trong một lựa chọn từ danh sách các tùy chọn đặt trước
Ví dụ sau chứa ba nút radio. Tùy chọn cuối cùng bị vô hiệu hóa
Thí dụ
Tùy chọn 1
Tùy chọn 2
Tùy chọn 3
Đối với các hộp kiểm, hãy sử dụng lớp .form-check-inline
nếu bạn muốn các nút radio xuất hiện trên cùng một dòng
Thí dụ
Tùy chọn 1
Tùy chọn 2
Tùy chọn 3
Danh sách chọn Bootstrap
Danh sách chọn được sử dụng nếu bạn muốn cho phép người dùng chọn từ nhiều tùy chọn
Ví dụ sau chứa danh sách thả xuống [danh sách chọn]
Thí dụ
Chọn danh sách.
Kích thước kiểm soát biểu mẫu
Thay đổi kích thước của điều khiển biểu mẫu bằng .form-control-sm
hoặc type="password"
0
Thí dụ
Kiểm soát biểu mẫu với văn bản thuần túy
Sử dụng type="password"
1 nếu bạn muốn tạo kiểu cho trường nhập dưới dạng văn bản thuần túy
Phạm vi và tệp điều khiển biểu mẫu
Thêm lớp type="password"
2 vào type="password"
3 hoặc type="password"
4 đến type="password"
5 để tạo kiểu cho điều khiển phạm vi hoặc trường tệp có chiều rộng đầy đủ
Có một số cách tiếp cận để làm cho một phần tử đầu vào giống như nhãn của nó. Vài cách tiếp cận được thảo luận ở đây. CSS cơ bản để gắn nhãn, mở rộng và đầu vào để có đầu ra rõ ràng
Sử dụng thuộc tính float và tràn. Tạo một nhãn và tạo kiểu cho nó với thuộc tính float. Bây giờ đặt nhãn nổi [vị trí] trái hoặc phải theo yêu cầu của bạn. Điều này sẽ căn chỉnh nhãn của bạn cho phù hợp. Thuộc tính tràn cho đầu vào được sử dụng ở đây để cắt phần tràn và hiển thị phần còn lại
- Thí dụ
type="password"
6type="password"
7type="password"
8type="password"
9.form-control
0.form-control
1.form-control
2.form-control
3type="password"
7____25.form-control
2.form-control
3type="password"
72type="password"
7type="password"
74.form-control
2type="password"
76type="password"
77type="password"
78type="password"
79type="password"
76type="password"
81type="password"
82type="password"
76type="password"
84type="password"
78type="password"
86type="password"
76type="password"
81type="password"
82type="password"
76type="password"
91type="password"
78type="password"
93type="password"
78type="password"
95type="password"
78type="password"
97type="password"
76type="password"
81type="password"
82type="password"
76.form-control
02type="password"
78.form-control
04type="password"
76type="password"
81type="password"
72.form-control
08type="password"
74.form-control
2.form-control
08.form-control
5.form-control
2.form-control
3type="password"
7____216____22type="password"
72type="password"
7.form-control
20.form-control
21.form-control
20.form-control
2type="password"
72type="password"
7.form-control
26.form-control
27.form-control
0.form-control
29.form-control
30.form-control
26.form-control
2type="password"
72type="password"
7.form-control
35.form-control
2type="password"
76type="password"
7.form-control
39type="password"
70.form-control
0.form-control
29type="password"
73.form-control
0.form-control
29type="password"
76type="password"
77______20type="password"
79.form-control
50.form-control
0.form-control
52.form-control
53type="password"
72.form-control
08.form-control
35.form-control
2.form-control
08.form-control
16____22.form-control
3.form-control
08type="password"
8.form-control
2 - đầu ra
Sử dụng thuộc tính ô của bảng trong thuộc tính hiển thị. Tạo nhãn bên trong div và cung cấp thuộc tính hiển thị. Để làm cho phần tử đầu vào và khoảng cách được đặt bằng nhau, hãy sử dụng thuộc tính ô bảng trong các thẻ đó. Thuộc tính này làm cho phần tử hoạt động như một phần tử td. Bất kỳ mục nào được tạo gần đó, thuộc tính ô bảng sẽ thực hiện việc đó
- Thí dụ
type="password"
6type="password"
7type="password"
8type="password"
9.form-control
0.form-control
1.form-control
2.form-control
3type="password"
7____25.form-control
2.form-control
3type="password"
72type="password"
7type="password"
74.form-control
2type="password"
76type="password"
77type="password"
78type="password"
79type="password"
76type="password"
81type="password"
82type="password"
76type="password"
729type="password"
78type="password"
731type="password"
78type="password"
733type="password"
76type="password"
81type="password"
82type="password"
76type="password"
84type="password"
78type="password"
740type="password"
78type="password"
742type="password"
78type="password"
744type="password"
76type="password"
81type="password"
82type="password"
76type="password"
91type="password"
78type="password"
740type="password"
78type="password"
753type="password"
76type="password"
81type="password"
82type="password"
76.form-control
02type="password"
78.form-control
04type="password"
76type="password"
81type="password"
72.form-control
08type="password"
74.form-control
2.form-control
08.form-control
5.form-control
2.form-control
3type="password"
7____216____22type="password"
72type="password"
7.form-control
20.form-control
21.form-control
20.form-control
2.form-control
3type="password"
72type="password"
7type="password"
783type="password"
784.form-control
0type="password"
786.form-control
2type="password"
76type="password"
7.form-control
26.form-control
27.form-control
0.form-control
29.form-control
30.form-control
26.form-control
2type="password"
76type="password"
7.form-control
35type="password"
800.form-control
39type="password"
70.form-control
0.form-control
29type="password"
73.form-control
0.form-control
29type="password"
808type="password"
77.form-control
0type="password"
79type="password"
808.form-control
50.form-control
0.form-control
52.form-control
53type="password"
76.form-control
08.form-control
35.form-control
2type="password"
72.form-control
08type="password"
783.form-control
2.form-control
08.form-control
16____22.form-control
3.form-control
08type="password"
8.form-control
2 - đầu ra
HTML là nền tảng của các trang web, được sử dụng để phát triển trang web bằng cách cấu trúc các trang web và ứng dụng web. Bạn có thể học HTML từ đầu bằng cách làm theo Hướng dẫn HTML và Ví dụ về HTML này
CSS là nền tảng của các trang web, được sử dụng để phát triển trang web bằng cách tạo kiểu trang web và ứng dụng web. Bạn có thể học CSS từ đầu bằng cách làm theo Hướng dẫn CSS và Ví dụ về CSS này