码迷,mamicode.com
首页 > 其他好文 > 详细

扩大可点击区域

时间:2017-09-18 16:15:43      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:nbsp   tom   log   for   ati   样式   pre   logs   扩大   

使用伪元素,伪元素在4个方向上都比宿主元素大

 1 button{
 2 position:relative;
 3 // 其他样式
 4 }
 5 
 6 button::before{
 7 content:"";
 8 position:absolete;
 9 top:-10px;
10 left:-10px;
11 bottom:-10px;
12 right:-10px;
13 }

不会干扰其他的效果,可以把区域设置为任何大小,任何位置。

 

扩大可点击区域

标签:nbsp   tom   log   for   ati   样式   pre   logs   扩大   

原文地址:http://www.cnblogs.com/Evo1uti0n/p/7543568.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!