Advertisement
Guest User

Font CSS Help

a guest
Jul 7th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.51 KB | Help | 0 0
  1. Hey there! I saw your comment on my guestbook, and since you asked about how to add custom fonts. So, I thought I'd leave a quick tutorial here X)
  2.  
  3. 1. You'll want to find what font you want to use. Google Fonts is usually a good place to get them.
  4. 2. Make sure that it's a TTF file! Technically, you can use woff or other font file formats, but I have had trouble getting them to work for whatever reason. I suggest using a TTF file just while you figure it out.
  5. 3. Upload it to your site. I have mine font file in a subfolder called "Fonts" in my main folder where I store all my files for the website that aren't actual HTML pages. (So, the path to it is /1/Fonts/rainyhearts.ttf)
  6. 4. In your CSS sheet, you'll need to that it knows that the font exists, where to find it, and where to use it. Here's a template/example:
  7.  
  8. @font-face {
  9.     font-family:'NameOfYourFont';
  10.     src: url(path/to/your/font.ttf);
  11.     font-weight: normal;
  12. }
  13.  
  14. html {
  15.   font-family:'NameOfYourFont';
  16. }
  17.  
  18. Since the font family is applied to the HTML tag, it'll apply it globally to the HTML page. You can set it up so you have two different fonts, and apply them differently to different tags. This is how mine looks:
  19.  
  20. @font-face {
  21.    font-family:'RainyHearts';
  22.    src: url(/1/Fonts/rainyhearts.ttf);
  23.    font-weight: normal;
  24. }
  25.  
  26. html, body {
  27.  font-family:'RainyHearts';
  28. }
  29.  
  30. (I removed some stuff from the HTML/Body part of the CSS because it wasn't relevant, but you can always go into inspect elements and look there, lol)
  31.  
  32. I hope this helps!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement