【发布时间】:2020-11-24 12:30:53
【问题描述】:
我一直在尝试更改此按钮上的字体,但它一直将其设置为默认设置。该代码引用了一个动画按钮,我希望将字体更改为“Roboto”。
.button {
display: inline-block;
border-radius: 0px;
background-color: transparent;
border: none;
color: #ffffff;
text-align: center;
font-size: 28px;
padding: 0px;
width: 0px;
font: roboto;
transition: all 0.5s;
cursor: pointer;
margin: 0px;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: 0px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
<a button class="button" style="vertical-align:middle" href="https://www.instagram.com/?hl=en"><span>Instagram</span></button>
【问题讨论】:
-
您是否包含了 Roboto 字体文件?
-
你为什么要用
</button>关闭你的<a>?text-align: centre和font: roboto;都不是有效的 CSS 规则。是text-align: center和font-family: Roboto;。使用browser console (dev tools)(点击F12)并阅读任何错误。