如何在CSS中设置边框中的背景颜色

时间:2016-02-06 14:20:28

标签: css border

.click{
    padding: 10px;
    border: 2px solid #e4910c;
    border-radius: 200px;
    transition: background-color 0.1s;
}

a:hover{
background-color: #e4910c;
color: white;
}

我试图在#e4910c的边界到处设置;但文字有填充。所以我只能将文本的背景颜色设置为#e4910c,而不是边框​​中的任何地方。 enter image description here 怎么做?提前谢谢

1 个答案:

答案 0 :(得分:0)

我不确定你想要什么,但请告诉我这是否适合你:

  • 仅使用a而不是两个标签(我了解您正在使用)

Snipet

a {
  padding: 10px;
  border: 2px solid #e4910c;
  border-radius: 200px;
  transition: background-color 0.1s;
  display:inline-block; /* demo purposes - optional */
  color:#e4910c;
  text-decoration:none;
    
}
a:hover {
  background-color: #e4910c;
  color: white;
}
<a href="#">Text link</a>

相关问题