label、input、table标签

时间:2023-03-08 18:56:03

<label>标签

  1. <form>
  2. <label for="male">Male</label>
  3. <input type="radio" name"sex" id="male"/>
  4. <br>
  5. <label for="femal">Female</label>
  6. <input type="radio" name="sex" id="female"/>
  7. </form>

<label> 标签为 input 元素定义标注(标记)。

label 元素不会向用户呈现任何特殊效果。不过,它为鼠标用户改进了可用性。如果您在 label 元素内点击文本,就会触发此控件。就是说,当用户选择该标签时,浏览器就会自动将焦点转到和标签相关的表单控件上。

<label> 标签的 for 属性应当与相关元素的 id 属性相同。

<input>

文本域:<input type="text" name=" ">

密码域:<input type="password" name=" ">
复选框:<input type="checkbox" name=" "><input type="checkbox" name=" ">
单选框 : <input  type="radio" checked="checked" name="sex" value="male">
              <input type="radio"  name="sex" value="female">
               name值相同
下拉列表:
  1. <form>
  2. <select name="cars">
  3. <option value="volvo">volvo</option>
  4. <option value="saab">saab</option>
  5. <option value="fiat">fiat</option>
  6. <option value="audi">audi</option>
  7. </select>
  8. </form>
带预选值的下拉列表:添加selected="selected"
文本域:<textarea rows="10" cols="30">this</textarea>
按钮: <input type="button" value="Hello world">
围绕数据的Fieldset:绘制一个带标题的框:
  1. <form>
  2. <fieldset>
  3. <legend>健康信息</legend>
  4. 身高:<input type="text">
  5. </fieldset>
  6. </form>
带有输入框和确认按钮的表单
  1. <form action="/example/html/form_action.asp" method="get">
  2. <p>First name:<input type="text" name="fname"></p>
  3. <p>Last name:<input type="text" name="lname"></p>
  4. <input type="submit" value="submit">
  5. </form>
  6. <p>请单击确认按钮,输入会发送到服务器上名为"form_action.asp"的页面。</p>
将输入框改为复选框可提交
从表单发送电子邮件
  1. <form action="MAILTO:someone@w3school.com.cn" method="post" enctype="text/plain">
  2. <h3>这个表单会把电子邮件发送到W3School。</h3>
  3. <input type="text" name="name" value="yourname" size="20">
  4. <input type="text" name="mail" value="yourmail" size="20">
  5. <input type="text" name="comment" value="yourcomment" size="40">
  6. <input type="submit" value="submit">
  7. <input type="reset" value="reset">
  8. </form>
<tabel>标签
<tr><td></td><td></td></tr>一行两列
表格边框<table border="1"></table>
                border的值表示边框大小
表头:<th></th>代替<td></td>  <th></th>中的字体自动加粗
带有标题的表格<caption></caption>
跨列:<td colspan="2"></td>
跨行:<td rowspan="2"></td>
cellpadding=" "表单填充
cellspadding     单元格填充
向表格添加背景颜色或者背景图像
<table border="1"  bgcolor="red"></table>
<table border="1"  bgckground=" "></table>