CSS悬停边框使内联元素略微调整 [英] CSS hover border makes inline elements adjust slightly

查看:94
本文介绍了CSS悬停边框使内联元素略微调整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个无序的列表填充或锚点。我有一个CSS:Hover事件,它添加边框,但所有的锚点到左边稍微调整,当我悬停,因为它添加1px的宽度和自动调整。我如何确保定位是绝对的?

I have an unordered list full or anchors. I have a CSS :Hover event that adds borders to it but all the anchors to the left slightly adjust when i hover because it is adding 1px to the width and auto adjusting. how do i make sure the positioning is absolute?

我做了一个JS小提琴这里

I made a JS Fiddle here.

推荐答案

您可以向非悬停状态添加透明边框,以避免边框出现:

You can add a transparent border to the non-hover state to avoid the "jumpiness" when the border appears:

http://jsfiddle.net/TEUhM/3/

#homeheader a:visited, #homeheader a{
    border:1px solid transparent;
}

这篇关于CSS悬停边框使内联元素略微调整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆