gpt4 book ai didi

html - 具有相同样式的链接和按钮

转载 作者:太空宇宙 更新时间:2023-11-04 12:25:04 25 4
gpt4 key购买 nike

我对链接和按钮使用相同的样式。但他们看起来不同。我怎样才能得到相同的外观?

<button class="button blue">Hello</button>
<br /><br />
<a class="button blue" href"#">Hello</a>



body {
background-color: #ccc;
font-family: Arial;
font-size: 12px;
color: #747476;
margin: 0 0 15px 0;
height: 100%;
width: 100%;
}

button, a.button {
width: auto;
min-width: 110px;
height: 30px;
line-height: 30px;
padding: 10px;
border: 0 none;
font-weight: bold;
text-align: center;
cursor: pointer;
text-decoration: none;
font-family: Tahoma;
}

button.button, a.button {
color: #fff !important;
}

button.button.blue, a.button.blue {
background-color: #2bb0df;
}

button.button.orange, a.button.orange {
background-color: #e95d0f;
}

JsFiddle

最佳答案

只需将以下两行添加到您的 button, a.button 的 css 代码中:

box-sizing: content-box;
显示:内联 block ;

大功告成。

body {
background-color: #ccc;
font-family: Arial;
font-size: 12px;
color: #747476;
margin: 0 0 15px 0;
height: 100%;
width: 100%;
}
button,
a.button {
width: auto;
min-width: 110px;
height: 30px;
line-height: 30px;
padding: 10px;
border: 0 none;
font-weight: bold;
text-align: center;
cursor: pointer;
text-decoration: none;
font-family: Tahoma;
display: inline-block;
box-sizing: content-box;
}
button.button,
a.button {
color: #fff !important;
}
button.button.blue,
a.button.blue {
background-color: #2bb0df;
}
button.button.orange,
a.button.orange {
background-color: #e95d0f;
}
<button class="button blue">Hello</button>
<br />
<br />
<a class="button blue" href "#">Hello</a>

关于html - 具有相同样式的链接和按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28072870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com