HTML inert 属性
示例
使用 inert 属性禁用一个部分
<div inert>
<button onclick="alert(42)">
<input type="text">
<a href="https://w3schools.com">W3Schools.com</a>
</div>
自己动手试一试 »
定义和用法
inert
属性会禁用一个元素及其内部的所有元素。
这些元素仍然可见,但它们没有任何功能:按钮和链接无法点击,输入字段被禁用等,并且屏幕阅读器会忽略它们。
浏览器支持
Attribute | |||||
---|---|---|---|---|---|
inert | 102 | 102 | 112 | 15.5 | 88 |
语法
<element inert>