学习笔记——编写注册表单

1.Vh表示视口高度,相当于height高度的1%

2.background-color、background、color

background-color:背景颜色,可以直接使用颜色或者16进制表示的颜色或者rgb等

background:背景,后跟一些函数,包括渐变的

color:字的颜色

body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color:#1b1b32;
  color:#f5f6f7;
}

 3.表单属性

表单数据发送

action=“” 数据发送到此地点

method=“get”或者“post”

get表示表单数据通过get请求作为URL参数发送,post请求作为请求正文中的数据发送。

构建一个基础表单

fieldset:一个区域

<label for="xxx">与<input id="xxx">配合使用

 <fieldset>
        <label for="first-name">Enter Your First Name: <input id="first-name"/></label>
        <label for="last-name">Enter Your Last Name: <input id="last-name"/></label>
        <label for="email">Enter Your Email: <input id="email"/></label>
        <label for="new-password">Create a New Password: <input id="new-password"/></label>
      </fieldset>

input的一些属性设置

type:类型,包括text、email、password、submit、radio、file(上传文件)、number

required:必填项

minlength:最小长度        minlength="8"

pattern:使用正则表达式校验密码 例如:匹配 8 个以上的小写字母或数字 0 到 5

pattern="[a-z0-5]{8,}"

name:给两个类型为radio的input设置相同的name可以设置无法同时选中

min:type为number的最小值

max:type为number的最大值

 <label for="new-password">Create a New Password: <input id="new-password" type="password" pattern="[a-z0-5]{8,}" required /></label>

textarea

与input的text相近,框框大小可以调整

可以用rows 和cols属性去指定行列大小

<label for="bio">Provide a bio:
          <textarea id="bio" rows="3" cols="30"></textarea>
        </label>

 placeholders属性可以接受一个文本值,在用户输入前进行提示

 <textarea id="bio" rows="3" cols="30" placeholder="I like coding on the beach..."></textarea>

css

属性选择器

input[name="password"]

input[type="submit"] {
  display:block;
  width:60%;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值