html+css学习day3(输入框、密码框、复选框、单选框、上传文件、提交和重置按钮、多行文本框、下拉菜单)

1、表单标签(和表格标签的区别是没有太多规范要求)

form、input

intput(单标签)标签有一个type属性,决定是什么控件

<form>

   第一个属性:输入

<h2>输入框:</h2>

      <input type="text"  placeholder=“请输入用户名”>placeholder是在输入框里面的文字

第二个属性:密码

      <h2>密码框:</h2>

      <input type="password" >这样输出来的密码是隐藏的

第三个属性:复选框

<h2>复选框:</h2>

      <input type="checkbox"   checked  就是默认被选上了>苹果

       <input type="checkbox">香蕉

          <input type="checkbox"     disabled  就是不能选>葡萄

第四个属性:单选

<h2>单选框:</h2>

      <input type=radio" name=“gender或者随便什么”>男

        <input type=radio" name=“ 必须和上面的name一样,被认为是一组这样就是单选框,只能选一个”>男

 

第五个属性 file属性(上传文件)

<h2>上传文件</h2>

<input type="file">


第六个属性提交和重置 

<h2>提交按钮和重置按钮</h2>

<input type="submit">

<input type="reset">

提交按钮后,要跳转到另一个页面,因此在第一行的form里面要加上跳转地址

<form action="http://............">但是真正的能跳转还得学习其他的

</form>

2、表单相关标签

多行文本框 textarea

<textarea cols=""    rows="" ></textarea>

下拉菜单select、option

<select>

          <option>北京</option>

          <option>上海</option>     

           <option>杭州</option>

</select>

如果想让最开始显示的默认值是上海

那么在 <option selected >上海</option>  加入selevted

如果想让最开始默认的是请选择并且不能选择请选择这一选项则在<select>标签里面加上

<option selected disabled>请选择</option>

多选文件可以加上multiple  <input type="file" multiple>

辅助表单label

可以扩大你的点击范围(提升用户体验)

<input type="radio" name="gender" id="man"><label for="man">男</label>

<input type="radio" name="gender" id="woman"><label for="woman">女</label>

3、表单表格的组合使用

  <form  action="">跳转地址

       <table border="1" cellpadding="30">

              <tBody>

                           <tr align="center">

                                   <td rowspan="4">总体信息</td>

                                    <td colspan="2">用户注册</td>

                          </tr>

                           <tr align="right">

                                    <td>用户名:</td>

                                     <td ><input type="text" placeholder="请输入用户名"><td>   

                           </tr>    

                            <tr align="right"> 

                                    <td>密码:</td>

                                     <td ><input type="password" placeholder="请输入密码"><td>   

                            </tr> 

                          <td colspan="2" align="center">

                                          <input type="submit">&nbsp&nbsp&nbsp&nbsp&nbsp

                                          <input type="reset">

                           </td>

                    

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值