Having some trouble with custom fonts

So, I decided to take upon an old project of making a website which is no longer needed, but I want to try and become a web designer so its a good project to start on.

Anyway, I am having some trouble with using custom fonts. I have looked at a few different websites, such as w3schools, stackoverflow and here but I can’t seem to find out why its wrong.

Here is the code:

@font-face {
    font-family: minecrafter;
	scr: url('fonts/Minecrafter.Reg');
}
.box2 {
    font-family: minecrafter;
	margin-top:10px;
    width:90%;
    margin:auto;
    height:200px;
    background:#707070;
}

<div class="box2">
<h2>&nbsp;&nbsp;Miners Union</h2>
</div>

If you need anything out of the rest of the code or the stuff to actually download the font, just say. The font link is right, as the folder is called fonts and is in the same folder as the index file is.

When this code is applied, nothing changes visually. I have tried on multiple browsers (chrome, explorer and firefox) to no avail.

Thanks!

Quick note: Is there anyway I can change my name? I have got no idea why I chose this one

Code tags don’t work here. You need to use three backticks ` on a line above your code, and three on a line below your code.

[quote=“TheLoneWanderer, post:1, topic:118749”]
Quick note: Is there anyway I can change my name? I have got no idea why I chose this one
[/quote]Send a PM to one of the Admins - @ralphm, @Jasmine or @Ophelie.

As far as your question goes, that doesn’t look like a correct URL for your font. Where did you obtain it?

This article might help; I found it very clear when I was getting to grips with @font-face:

Check your original code to see if this typo is there too (You spelled ‘src’ as ‘scr’).

1 Like

Good spotting, @WebMachine! I missed that completely.

Ah ok, still getting used to the new layout here. Thanks for editing it

http://www.dafont.com/minecrafter.font is where I got the font from

I have tried a few things from that website, and changed the .Reg to .Ttf and added the format after it but nothing seems to have worked. I’ve also tried putting it at the start of the file infront of the other commands but that hasn’t worked either.

Good spot I didn’t see that, I have changed it but still nothing actually happened. It would have been a recent typo as just before posting this I re did it all.

I’ve just tried downloading the font, and it looks as if the name should be Minecrafter.Reg.ttf. Have you tried that?

[quote=“TheLoneWanderer, post:5, topic:118749”]
Not to sure how to reply to multiple posts at once
[/quote]You just highlight the bit you want to quote, and a grey “quote reply” box will pop up. Click on that.

Done that, and it works :smiley: Thanks for your help

Also thanks for teaching me the basics of the new layout :smile:

Glad you got it working.

For future reference, you might want to bookmark this, which helps get to grips with the idiosyncrasies of the forum:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.