admin管理员组文章数量:1302900
I'm trying to use the font-face rule in a style block on a html page, rather than in a style sheet. But it's not working.
My aim in doing this is to improve the load time of the Largest Contentful Paint on the page in question, which I've narrowed down to the image and font being used in the header of the page.
So far I've converted the image to the webp format and the font to the woff format. I've also moved the css related to the font family and image in the header from styles defined in a linked style sheet to styles defined in a styleblock in the head section of the page.
For some reason the image is still loading fine but the font is defaulting to something else. This is in both Firefox and chrome. The location of the font in relation to the page has not changed. The font, the web page and the style sheet are all in the same directory.
So far I've only tested this in a local environment becuase I want it to work right before I go live with it.
I can only find forum posts on defining the font family in css - not specifically in style blocks on a html page.
Can you spot anything wrong in my code?
<style type = "text/css">
@font-face{
font-family:SonsieOne;
src: url(SonsieOne-Regular.woff) format('woff');
}
#header{
max-width: 100%;
height:auto;
background-image: url(superspreads-header-4.webp);
background-repeat:no-repeat;
border-top:2px solid #d9c8ba;
border-left:2px solid #d9c8ba;
border-right:2px solid #d9c8ba;
border-bottom:0px solid }
.header-text{
/*margin-top:-145px; for when img in html*/
margin-top:8px;
margin-bottom:-15px;
padding-left:10px;
color:#A6846B;
font-family:SonsieOne;
font-style:normal;
text-align:center;
text-shadow: 2px 2px 5px #000000;
font-size:333%;}
</style>
本文标签: How do I define fontface ON a HTML page rather than in a stylesheetStack Overflow
版权声明:本文标题:How do I define font-face ON a HTML page rather than in a stylesheet? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741698361a2393141.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论