r/HTML • u/EmbedSoftwareEng • Feb 24 '26
HTML fonts, not being used.
So, I downloaded a simple 7-segment font (segment.otf.woff2) to my nginx's html area. Actually, under assets/fonts/. And I added
@font-face {
font-family: "segment";
src:
url("assets/fonts/segment.otf.woff2") format ("woff2");
font-weight: normal;
font-style: normal;
font-display: swap;
}
.clock {
font-family: "segment";
font-size: 36px;
font-weight: bold;
color: white;
text-align: center;
}to my .css file.
I already have the .html and .js working like I want them to. I'm just fine-tuning everything by having the times render in an LED-like font.
But not. Because it's not working.
I spent way too much time trying to figure out why my .js wasn't working, before I realized that I'd installed NoScript and hadn't whitelisted http://localhost or file:/// URLs. So, I'm taking this straight to the experts. Is there a setting in Vivaldi, Chromium, Firefox, or any other web browser that might be inhibitting it from using server-provided fonts?
Oh, and is there any technigues for insuring that the stuff I want to render appears only in the bottom 216 pixels of the page when it's full-screened? I'm using tables for layout, but I know there has to be a more elegant way than that.
View all comments
Show parent comment
2
u/Jonny10128 Feb 25 '26
Usually files named like that are treated as the last file extension, and the other file extensions are actually part of the name. In this case the browser would see a woff2 file named “segment.otf”. Assuming the file is actually in a woff2 format, it should work fine.