在使用 HTML 字体样式时需要帮助
Need help using HTML Font Style
我的代码需要一些帮助
我如何使用这种字体样式 - "brandon grotesque"。
我似乎无法更改字体样式,因为我不知道如何插入
这种字体样式到我的代码中。
下面是我的代码:
<style>
footer{
position:absolute;
bottom:0;
width:100%;
height:100px;
margin-top:-100px;
border-style: solid;
border-width: 0px;
background-color: lightgrey;
}
</style>
<body>
<footer>
<div>
<p style="font-size: 30px; text-align:center;">© Copyright 2020, SCOPE
Industries Berhad</p>
</div>
</footer>
</body>
</html>
尝试将 font-family: 'brandon grotesque'
包含到您的 footer
css class 中。我不确定是否必须正确大写,但尽量确保以防万一。
也尽量不要定义footer
两次。没必要。
编辑:
大小写无所谓,好像也不行哎呀。但也许这个 link 会有所帮助:https://www.pagecloud.com/blog/how-to-add-custom-fonts-to-any-website
您是否通过@font-face 将字体文件添加到CSS,我认为这里的问题是您没有为浏览器添加字体文件。你应该先添加字体文件然后你可以定义添加到 CSS.
的字体
@font-face {
font-family: myFirstFont;
src: url(brandon_grotesque.woff);
}
footer{
position:absolute;
bottom:0;
width:100%;
height:100px;
margin-top:-100px;
border-style: solid;
border-width: 0px;
background-color: lightgrey;
font-family: 'any_font_name_you_imported', sans-serif !important;
}
示例:
<html>
<head>
<link href="https://fonts.googleapis.com/css?
family=Noto+Sans+SC&display=swap" rel="stylesheet">
</head>
<body>
<footer>
<h1>Hii</h1>
</footer>
</body>
</html>
我的代码需要一些帮助 我如何使用这种字体样式 - "brandon grotesque"。 我似乎无法更改字体样式,因为我不知道如何插入 这种字体样式到我的代码中。 下面是我的代码:
<style>
footer{
position:absolute;
bottom:0;
width:100%;
height:100px;
margin-top:-100px;
border-style: solid;
border-width: 0px;
background-color: lightgrey;
}
</style>
<body>
<footer>
<div>
<p style="font-size: 30px; text-align:center;">© Copyright 2020, SCOPE
Industries Berhad</p>
</div>
</footer>
</body>
</html>
尝试将 font-family: 'brandon grotesque'
包含到您的 footer
css class 中。我不确定是否必须正确大写,但尽量确保以防万一。
也尽量不要定义footer
两次。没必要。
编辑: 大小写无所谓,好像也不行哎呀。但也许这个 link 会有所帮助:https://www.pagecloud.com/blog/how-to-add-custom-fonts-to-any-website
您是否通过@font-face 将字体文件添加到CSS,我认为这里的问题是您没有为浏览器添加字体文件。你应该先添加字体文件然后你可以定义添加到 CSS.
的字体@font-face {
font-family: myFirstFont;
src: url(brandon_grotesque.woff);
}
footer{
position:absolute;
bottom:0;
width:100%;
height:100px;
margin-top:-100px;
border-style: solid;
border-width: 0px;
background-color: lightgrey;
font-family: 'any_font_name_you_imported', sans-serif !important;
}
示例:
<html>
<head>
<link href="https://fonts.googleapis.com/css?
family=Noto+Sans+SC&display=swap" rel="stylesheet">
</head>
<body>
<footer>
<h1>Hii</h1>
</footer>
</body>
</html>