ITMISS
您可以使用框阴影而不是边框来实现此类功能。这是有效的,因为你的阴影不会“占用DOM中的大小”,因此不会影响定位,不像边框那样。尝试使用像这样的声明box-shadow:0 0 1px 1px #102447;而不是你的border:1px solid #102447;在你的悬停状态。以下是此操作的快速演示:DEMO#homeheader a:visited,#homeheader a {
text-decoration: none;
color: black;
margin-right: 5px;}#homeheader a:hover {
background-color: #D0DDF2;
border-radius: 5px;
box-shadow: 0 0 1px #102447;}#homeheader li {
padding: 0;
margin: 0px 10px;
display: inline;
font-size: 1em;}
- this
- that
- this again
- that again