11HTML属性变化

[目录]

一、input新增类型

  1. 电子邮箱input类型:<input type="email" name="email">
  2. 统一资源定位符input类型:<input type="url" name="url">
  3. 电话号码input类型:<input type="tel" name="tel">
  4. range input类型:<input type="range" name="range" min="1" max="10">
  5. search input类型:<input type="search" name="search">
  6. color input类型:<input type="color" name="color">

二、表单新增属性

  1. autocomplete属性:自动完成功能
    适用于<form>标签和以下类型的<input>标签:text、search、url、telephone、email、password、datepickers、range、color,例如:<form autocomplete="on"></form>
  2. autofocus属性:规定在页面加载时,域自动地获得焦点
    autofocus属性适用于所有的<input>标签的类型,例如:<input autofocus="autofocus">
  3. multiple规定输入域中可选择多个值
    适用于以下类型的<input>标签:email和file,例如:<input type="file" multiple="multiple"/>
  4. placeholder属性:提供一种提示,描述输入域所期待的值
    适用于<input>标签type属性值:text、search、url、telephone、email、password,例如:<input type="search" placholder="search content"/>
    补充:onFocus事件就是当光标落在文本框中时发生的事件;onBlur事件是光标失去焦点时发生的事件
  5. require属性:规定必须在提交之前填写输入域(不能为空)
    适用于<input>标签type属性值:text、search、url、telephone、email、password、datepickers、number、checkbox、radio、file,例如:<input type="text" required="required"/>,此方法可以减少前端开发人员填写表单验证的压力

三、其他标签属性

  1. 链接属性
  • sizes:根据不同的分辨率引用不同的sizes
    <link rel="icon" href="icon.gif" type="image/gif" sizes="16×16">
  • targe
    <base href="http://localhost/" target="_blank">
    不添加target属性时默认为_self
  • 超链接
    • a:media=""(表示对设备进行优化,handheld对“手持”设备进行支持,tv对电视设备进行支持)
    • a:hreflang="zh"(设置语言,这里设置语言显示中文)
    • a:rel="external"(设置超链接的引用,这里超链接为外部链接)
  1. 其他属性
  • script
    • defer:加载完脚本后并不执行,而是等整个页面加载完之后再执行,例如:<script defer src="url"></script>
    • async:加载完脚本后立刻执行,不用等整个页面都加载完,属于异步执行,例如:`
  1. ol有序列表
    • star——初始值
    • reverse——倒序排列
  2. html
    manifest="cache.manifest"(定义页面离线应用文件)
    <html manifest="cache.manifest">
    
  3. *style scoped:内嵌CSS
    <style scoped>//可以写在任何位置,里面写CSS代码
    ......
    </style>
    
posted @ 2020-05-25 17:35  a_哆肉  阅读(115)  评论(0编辑  收藏  举报