Home > Web Front-end > CSS Tutorial > How Do I Link External CSS and Font Files from Nested Folders in My Website?

How Do I Link External CSS and Font Files from Nested Folders in My Website?

Linda Hamilton
Release: 2024-11-29 07:09:09
Original
105 people have browsed it

How Do I Link External CSS and Font Files from Nested Folders in My Website?

Linking External CSS and Font Files

When organizing website files, it becomes necessary to link external CSS and font files. In this scenario, you have a "Website" folder with HTML and CSS files and a nested "Fonts" folder containing multiple folders for different fonts.

Linking the Font-Face CSS File

To link your font-face CSS file, use the following in your HTML file:

href="/fonts/font-face.css"
Copy after login

This will reference the CSS file from the "Fonts" folder relative to the HTML file's location.

Linking the Fonts

To link the fonts from their respective folders within the "Fonts" folder, use:

src: url("/fonts/font1/font1.ttf") format("truetype");
Copy after login

For the SVG format:

src: url("/fonts/font1/font1.svg") format("svg");
Copy after login

File Path Reminder

To navigate through file paths effectively, remember the following rules:

  • "/" refers to the root directory.
  • "../" moves one directory backwards.
  • "../../" moves two directories backwards.
  • To move forward, specify the subdirectory names.

The above is the detailed content of How Do I Link External CSS and Font Files from Nested Folders in My Website?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template