自習10 | web制作
本日は…
■連休なので自習
HTML5を使ったフォームの作成
必須項目
<form action="#" method="post"> <input type="submit" value="送信"> </form>
formとsubmit
中身に合わせて
1.テキストタイプのインプット領域
<label for=""></label> <input type="text" size="" id="" name="">
2.emailやtelのインプット領域
<input type="email" size="" id="" name=""> <input type="tel" size="" id="" name="">
※emailは@が間に入った形式じゃないとエラーを返す
3.セレクトボックス
<select id="" name="" required> <option value="" selected="selected"></option> <option value=""></option> </select>
4.ラジオボタン
<input type="radio" value="○☓" id="type1" name="type" required> <label for="type1">○☓</label> <input type="radio" value="△□" id="type2" name="type" required> <label for="type2">△□</label>
5.テキストエリア
<textarea id="" name="" cols="30" rows="5" required> </textarea>
※すべての要素にrequired=必須項目の指定ができる
※一つに対してだけ、autofocusを設定することができる
※※placeholder=""とすると予め入れておく文言が指定できる→選択後消える