W3.CSS Wejście
Formularz wejściowy
Najlepsze etykiety
Formularz wejściowy
Przykład
<form class="w3-container">
<label>First Name</label>
<input class="w3-input" type="text">
<label>Last Name</label>
<input class="w3-input" type="text">
</form>
Etykiety dolne
Formularz wejściowy
Przykład
<form class="w3-container">
<input class="w3-input" type="text">
<label>First Name</label>
<input class="w3-input" type="text">
<label>Last
Name</label>
</form>
Karty wejściowe
nagłówek
Przykład
<div class="w3-card-4">
<div class="w3-container
w3-green">
<h2>Header</h2>
</div>
<form class="w3-container">
<label>First Name</label>
<input class="w3-input"
type="text">
<label>Last Name</label>
<input class="w3-input"
type="text">
</form>
</div>
Kolorowe etykiety
Użyj dowolnej z klas w3-text-color , aby pokolorować etykiety:
Przykład
<form class="w3-container">
<label
class="w3-text-blue"><b>First Name</b></label>
<input class="w3-input w3-border" type="text">
<label
class="w3-text-blue"><b>Last Name</b></label>
<input class="w3-input w3-border" type="text">
<button class="w3-btn
w3-blue">Register</button>
</form>
Wejście obramowane
Dodaj klasę w3-border , aby utworzyć dane wejściowe z obramowaniem:
Przykład
<input class="w3-input w3-border"
type="text">
Zaokrąglone granice
Użyj dowolnej z klas w3 round , aby utworzyć zaokrąglone obramowania:
Przykład
<input class="w3-input w3-border w3-round"
type="text">
<input class="w3-input w3-border
w3-round-large"
type="text">
Wprowadzanie bez obramowania
Klasa wejściowa w3 ma domyślnie dolną granicę. Jeśli chcesz wprowadzić dane bez obramowania, dodaj klasę w3-border-0 :
Przykład
<form class="w3-container w3-light-grey">
<label>First
Name</label>
<input class="w3-input w3-border-0" type="text">
<label>Last Name</label>
<input class="w3-input
w3-border-0" type="text">
</form>
Zabarwienie
Zapraszam do korzystania z ulubionych stylów i kolorów:
Formularz wejściowy
Przykład
<div class="w3-container w3-teal">
<h2>Input Form</h2>
</div>
<form class="w3-container">
<label class="w3-text-teal"><b>First Name</b></label>
<input class="w3-input w3-border w3-light-grey" type="text">
<label class="w3-text-teal"><b>Last Name</b></label>
<input class="w3-input w3-border w3-light-grey" type="text">
<button class="w3-btn w3-blue-grey">Register</button>
</form>
Unoszące się wejścia
Klasy w3-hover- color dodają kolor tła do pola wejściowego po najechaniu myszą:
Przykład
<input class="w3-input w3-hover-green" type="text">
<input class="w3-input
w3-border w3-hover-red" type="text">
<input class="w3-input
w3-border w3-hover-blue" type="text">
Wejścia animowane
Klasa w3-animate-input przekształca szerokość pola wejściowego do 100%, gdy staje się fokusem:
Przykład
<input class="w3-input w3-animate-input"
type="text" style="width:30%">
Przykład
<input class="w3-check" type="checkbox" checked="checked">
<label>Milk</label>
<input class="w3-check"
type="checkbox">
<label>Sugar</label>
<input class="w3-check" type="checkbox" disabled>
<label>Lemon (Disabled)</label>
Przykład
<input class="w3-radio" type="radio" name="gender" value="male" checked>
<label>Male</label>
<input class="w3-radio"
type="radio" name="gender" value="female">
<label>Female</label>
<input class="w3-radio"
type="radio" name="gender" value="" disabled>
<label>Don't know (Disabled)</label>
Wybierz opcje
Przykład
<select class="w3-select" name="option">
<option value="" disabled
selected>Choose your option</option>
<option value="1">Option
1</option>
<option value="2">Option 2</option>
<option
value="3">Option 3</option>
</select>
Obramowane Wybierz Menu
Przykład
<select class="w3-select w3-border" name="option">
Elementy formularza w siatce
W tym przykładzie używamy Responsive Grid System W3.CSS, aby dane wejściowe pojawiały się w tej samej linii (na mniejszych ekranach będą układać się poziomo ze 100% szerokością). Więcej na ten temat dowiesz się później.
Przykład
<div class="w3-row-padding">
<div class="w3-third">
<input class="w3-input w3-border" type="text" placeholder="One">
</div>
<div class="w3-third">
<input
class="w3-input w3-border" type="text" placeholder="Two">
</div>
<div class="w3-third">
<input class="w3-input
w3-border" type="text" placeholder="Three">
</div>
</div>
Siatka z etykietami
Przykład
<div class="w3-row-padding">
<div class="w3-half">
<label>First Name</label>
<input
class="w3-input w3-border" type="text" placeholder="Two">
</div>
<div class="w3-half">
<label>Last
Name</label>
<input class="w3-input
w3-border" type="text" placeholder="Three">
</div>
</div>