在Web开发中,按钮是我们常常需要用到的元素之一。为了提高用户体验,我们经常会为按钮添加一些视觉特效,而其中一个重要的特效就是聚焦效果。CSS中添加聚焦效果非常简单,我们只需要在按钮元素上使用:foc
html <p>例子1:</p> <pre> <button>无聚焦效果</button> <button class="focus">有聚焦效果</button>
css button:focus { outline: 2px solid blue; }
html <p>例子2:</p> <pre> <button>无聚焦效果</button> <button class="focus">有聚焦效果</button>
css button:focus { outline: 0; box-shadow: 0 0 8px rgba(0, 0, 255, 0.8); }
粉丝
0
关注
0
收藏
0