【发布时间】:2016-01-11 02:32:58
【问题描述】:
我有一个页面,其中包含小元素,边框半径设置为 50%,因此它们显示为小点:
CSS:
.star {
width: 5px;
height: 5px;
background-color: rgb(236, 236, 236);
position: absolute;
border-radius: 50%;
transform: scale(1);
display: block;
transition: 0.25s ease-in background-color, 0.25s ease-in opacity, 0.25s ease-out transform;
cursor: pointer;
}
每一个都有一个悬停动作,会弹出一个特定的弹出窗口。然而,现在存在一个问题,即悬停(至少在我测试过的浏览器中)是一种寻找像素的游戏。
是否有一种“技巧”可以在点上添加一个不可见的边框,以使它们在不寻找像素的情况下更具选择性?
将border 设置为2px solid transparent 只会使我的测试中的圆圈变大,而CSS outline 不会产生:hover 状态或mouseenter 事件。
【问题讨论】: