简体   繁体   English

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

[英]How to set background color in border in CSS

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

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

I tried to set everywhere in border to #e4910c; 我试图将边界设置为#e4910c; But the text has padding. 但是文本有填充。 So I only can set text's background color to #e4910c, not everywhere in the border. 因此,我只能将文本的背景色设置为#e4910c,而不能将其设置在边框的任何地方。 在此处输入图片说明 How to do that? 怎么做? Thank you in advance 先感谢您

I'm not quiet sure about what you want, but let me know if this will suit you: 我不确定您要什么,但请告诉我是否适合您:

  • using only a instead of two tags (which I understand you are using) 仅使用a而不是两个标签(据我了解,您正在使用)

Snipet ni

 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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM