label标签和表单元素之间的键盘可访问性实例页面
回到相关文章 »效果:
代码:
CSS代码:
.btn { display: inline-block; padding: 2px 12px; background-color: #cd0000; color: #fff; font-size: 14px; cursor: pointer; } [type="submit"] { position: absolute; clip: rect(0 0 0 0); } :focus + label.btn { outline: 1px dotted Highlight; outline: 5px auto -webkit-focus-ring-color; }
HTML代码:
<form> <p>用户名:<input></p> <p> <input id="t" type="submit"> <label class="btn" for="t">提交</label> </p> </form>