[HTML5] Accessible Icon Buttons
Icon buttons are very common in web applications, yet they often have accessibility problems. Learn how to make your icon buttons accessible to keyboard and screen reader users with HTML, CSS, SVG and ARIA.
<!DOCTYPE html> <html lang="en"> <head> <title>Button Demo</title> <link rel="stylesheet" type="text/css" href="css/demo.css"> </head> <body> <main> <button>Help!</button> <button> <span class="visuallyhidden">Help!</span> <i class="icon icon-help" aria-hidden="true"></i> </button> <!-- alternate labeling technique: aria-label --> <button aria-label="Help!"> <i class="icon icon-help" aria-hidden="true"></i> </button> <div class="button" role="button" tabindex="0"> <svg width="32" height="32" viewBox="0 0 32 32" class="icon" aria-labelledby="svgtitle"> <title id="svgtitle">Help!</title> <path d="M14 24h4v-4h-4v4zM16 8c-3 0-6 3-6 6h4c0-1 1-2 2-2s2 1 2 2c0 2-4 2-4 4h4c2-0.688 4-2 4-5s-3-5-6-5zM16 0c-8.844 0-16 7.156-16 16s7.156 16 16 16 16-7.156 16-16-7.156-16-16-16zM16 28c-6.625 0-12-5.375-12-12s5.375-12 12-12 12 5.375 12 12-5.375 12-12 12z"></path> </svg> </div> </main> </body> </html>
.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2017-04-13 [Angular] Create custom validators for formControl and formGroup
2016-04-13 [Docker] Docker Machine intro
2016-04-13 [Javascript] JavaScript Array Methods in Depth - push
2015-04-13 [AngularJS + Webpack] require directives
2015-04-13 [AngularJS + Webpack] Using Webpack for angularjs