简体   繁体   English

对按钮使用边框半径

[英]Using border-radius to the button

Here's my CSS code这是我的 CSS 代码

.btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    text-align: center;
}

.btn a{
    display: inline-block;
    background: #efd9ca;
    padding: 10px;
    text-decoration: none;
    font-size: 90%;
    font-weight: 700;
    border-radius: 5px;
}

In here, border-radius works well to the button box.在这里,border-radius 适用于按钮框。 However, when I put border-radius to .btn class it does not work.但是,当我将边界半径设置为.btn class 时,它不起作用。 Whats' the reason behind it?背后的原因是什么?

Thank you!!谢谢!!

 .btn { position: absolute; right: 10px; bottom: 10px; text-align: center; padding:0; background-color: transparent; border:none; }.btn a{ display: inline-block; background: #efd9ca; padding: 10px; text-decoration: none; font-size: 90%; font-weight: 700; border-radius: 10px; transition: all.5s; }.btn a:hover{ background-color: #Ff5678; color:white; }
 <button class="btn"><a>My button</a></button>

I think border-radius is override from button box so if you want to use border-radius from .btn class then you need to write !important like below:我认为border-radius是按钮框覆盖的,所以如果你想使用.btn class 中border-radius ,那么你需要编写!important如下所示:

border-radius:10px !important

try this it works for you.试试这个它对你有用。

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

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