记录一些可能被忽视的html属性

Accept

Accept 属性用于指定浏览器可以处理的 MIME 类型列表。

<input type="file" accept=".jpg, .png">

Autofocus

Autofocus 属性用于在页面加载时自动将焦点设置到指定元素。

<input type="text" autofocus>

Inputmode

Inputmode属性是用于指定在文本框中输入的内容类型的属性。

<input type="text" inoutmode="url">

text:默认值,表示输入任意文本。

none:表示不需要输入。

tel:表示输入电话号码。

url:表示输入的URL地址。

电子邮件:表示输入电子邮件地址。

numeric:表示输入的数字。

decimal:表示输入带小数点的数字。

Autocomplete

utocomplete 属性是用于指定表单元素是否启用自动完成的属性。

<input name="credit-card-number" id="credit-card-number" autocomplete="off">

自动完成可帮助用户更快地填写表单并减少输入错误的机会。同时我们也可以禁用一些输入框的自动补全功能,比如身份证输入框。

Download

Download属性是用于在链接下载文件时指定文件名的属性。

<a href="document.pdf" download>DownLoad</a>

Contenteditable

HTML中的Contenteditable属性是用来指定元素是否可编辑的属性。

<div contenteditable="true">
	this text can be edited by the user
</div>

Spellcheck

HTML 中的 Spellcheck 属性是用来指定是否对元素启用拼写检查的属性。

<div contenteditable="true" spellcheck="true">
	this text can be edited by the user
</div>

translate

HTML 中的 Translate 属性是用于指定元素是否应被翻译的属性。

<p translate="no">Printing work</p>

datetime

datetime是HTML<time>标签的一个属性,用来指定日期和时间。
https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/ins

<p>“You're late!”</p>
<del>
    <p>“I apologize for the delay.”</p>
</del>
<ins cite="../howtobeawizard.html" datetime="2018-05">
    <p>“A wizard is never late …”</p>
</ins>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值