li:hover使li中a标签颜色改变

.container .buttons{
  list-style: none;
  display: flex;
  justify-content: flex-start;
}
.container .buttons li{
  padding: 10px 20px; // 必须
  border: 1px solid #ccc;
  border-radius: 10px;
  margin-left: 30px;
  cursor: pointer;  // 必须
}
.container .buttons li a{
  text-decoration: none;
  color: #000;
  font-size: 18px;
}
.container .buttons li:hover{
  background-color: #79fe4d;
}
.container .buttons li:hover a{
  color: #fff;
}

hover下的a标签的字体修改,要写a标签,hover在li上,text-decoration要在a上。list-style写在ul上,

猜你喜欢

转载自blog.csdn.net/qq_27009517/article/details/120672703