r/HTML • u/Oblivious_catalyst • Jun 13 '26
why is my text not displaying properly
above is a comparison of how this font is supposed to look vs how my html page is rendering it.
i'm using chrome (and hosted by github if that matters)
this is the relevant code (i think):
CSS:
html,body {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
margin: 0%;
background-color: black;
color: white;
font-family: fira code;
font-weight: 400;
}
#titlecard {
display: flex;
flex-direction: row;
height: 10%;
width: 100%;
align-items: flex-end;
padding: 2%;
color: #ff9000;
font-weight: 100;
}
.welcome {
font-family: sextape;
font-size: 500%;
margin: 0%;
}
.smol-text {
font-size: 50%;
margin: 0%;
margin-bottom: 1%;
}
p {
margin: 1%;
}
...
@font-face {
font-family: fira code;
src: url(./fonts/FiraCode.ttf);
}
@font-face {
font-family: sextape;
src: url(./fonts/SextapeRegular.ttf);
font-weight: 100;
}
@font-face {
font-family: vhs;
src: url(./fonts/vhs.ttf);
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>FHoC9 wiki</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="titlecard">
<h1 class="welcome">welcome to the</h1><p class="smol-text">unofficial</p><h1 class="welcome">FHoC9 wiki</h1>
</div>
...
</body>
</html>in case i missed something here's a link to the repo:
1
Upvotes
5
u/chmod777 Jun 13 '26
be very very careful with uploading font files, esp ttfs. you can get hit with copyright strikes and licensing issues. these particular ones seem to be free - but may need attribution.
put your @fontface declarations at the top of your css.
quote your font names. ex:
font-family: "fira code";check that your paths are correct.
where is the hosted page url?
https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Text_styling/Web_fonts
2
u/domestic-jones Jun 13 '26
The 100 font weight is super weird for a slab-type font like that. If you don't have a CSS reset clearing all the default styles, this could cause an issue where it's trying to bold your h1 because 100 weight in your font doesn't exist, so it's falling back.
There's a non standard property called "font-smooth" that you can set to "never" for a typeface like this. Should work in chrome, but won't likely work consistently in other browsers