• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Font Face not working

ryanforprez

New Coder
I have a site that I am hosting through siteground and my font-face property isn't showing up when I make the site live, it works fine in preview mode. I have tried saving as a woff, otf, ttf everything and it is not working.
CSS:
@font-face {
    font-family: Sans;
    src: url("Fonts/BeanSans-Regular.otf");
}
.header2 {
    flex: 1;
    padding-left: 75%;
    padding-top:1%;
    padding-right: 5%;
    font-size: 22px;
    line-height: 45px;
    font-family: Sans;
    align-content: left;
}


p {
  padding: 10px; 
  font-family: Sans;
  font-size: 20px;
  letter-spacing: 3px;
  color: black;
  text-align: left;
  
}
 

Malcolm

Administrator
Administrator
Verified
I'm looking over the documentation about @font-face on MDN and notice that some of the examples include a format. Have you tried defining the format?
 

ryanforprez

New Coder
The other font that is not showing up:
CSS:
@font-face {
    font-family: DummySans;
    src: url("Fonts/DummySans-Regular.otf");
}

.nav {
    width:25%;
    position: fixed;
    padding-left: 0.5%;
    padding-top:0%;
    padding-right: 20px 20px;
    font-size: 22px;
    line-height: 45px;
font-family: DummySans;
    letter-spacing: .35px;

}
.header1 {
    flex:1;
    padding-left: 0%;
    padding-top: 0px;
    padding-right: 30px 20px;
    font-size: 20px;
    line-height: 20px;
    font-family: DummySans;
    align-content: left;
 

Malcolm

Administrator
Administrator
Verified
I'm sorry I am a bit new to this, how do I define the format?
From what the documentation says you add it after the location of the font. E.g.

CSS:
 src: url("Fonts/BeanSans-Regular.otf") FORTMAT GOES HERE;

src: url("Fonts/BeanSans-Regular.woff") format("woff");

 

ryanforprez

New Coder
From what the documentation says you add it after the location of the font. E.g.

CSS:
 src: url("Fonts/BeanSans-Regular.otf") FORTMAT GOES HERE;

src: url("Fonts/BeanSans-Regular.woff") format("woff");

Unfortunately that did not solve the problem either at least for my header in one spot on safari. www.ryanstewsart.com
 

frendzit

New Coder
I noticed you don't have any paragraphs or headers with class = header2 this could be why it's not applying.
[Link removed by moderator - advertising]
 
Last edited by a moderator:
Top Bottom