.menu{
width: 100%;
position: fixed;
background-color: #333;
}
.menu nav ul{
list-style: none;
list-style-type: none;
padding: 0;
margin: 0;
}
.menu nav ul li{
display: inline-block;
}
.menu nav ul li button{
margin-left: 20px;
background-color: #d63031;
font-size: 22px;
color: #fffff7;
border-style: none;
border-bottom: 4px solid rgba(0,0,0,.3) !important;
padding: 15px 22px;
text-transform: uppercase;
font-family: 'Open Sans', sans-serif;
outline: none;
border-radius: 6px;
}
.menu nav ul li a{
display: block;
padding: 30px 20px;
font-size: 22px;
color: #fffff7;
line-height: 12px;
text-decoration: none;
text-transform: uppercase;
}
.menu nav ul li a:hover{
transition: all .3s ease;
-o-transition: all .3s ease;
-ms-transition: all .3s ease;
-moz-transition: all .3s ease;
-webkit-transition: all .3s ease;
background-color: rgb(0,0,0,.8);
font-size: 26px;
}
答案 0 :(得分:0)
只需分享我的代码,使用transform
缩放font-size
上的文字而不是a:hover
,希望它符合您的要求或为您提供灵感:
a {
display: block;
padding: 30px 20px;
font-size: 22px;
}
a:hover {
-webkit-transform: scale(1.18); /* 22px * 1.18 = 26px */
-moz-transform: scale(1.18); /* 22px * 1.18 = 26px */
transform: scale(1.18); /* 22px * 1.18 = 26px */
}
ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
}
li {
border: 1px solid #ccc;
}
li a {
padding: 30px 20px;
transition: all .3s;
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">another link</a></li>
</ul>
</body>
</html>
&#13;