Home >Web Front-end >CSS Tutorial >How Do I Link External CSS and Font Files from Separate Folders in My Website Project?
Imagine having a "Website" folder where your website files reside, and a separate "Fonts" folder that contains font subfolders. If your HTML and CSS files are in the Website folder, how do you link them to elements within the Fonts folder?
To link your font-face CSS file located in the "/fonts" folder, use the following syntax in your href:
href="../../fonts/stylesheet.css"
To link to fonts located in subfolders within the "Fonts" folder, use the following syntax in your src:
src: url('../../fonts/font1/font1.ttf') format('truetype'), url('../../fonts/font1/font1.svg') format('svg');
Relative File Path Reminder:
When navigating through directories using file paths:
By understanding these conventions, you can link CSS and font files from external folders accurately.
The above is the detailed content of How Do I Link External CSS and Font Files from Separate Folders in My Website Project?. For more information, please follow other related articles on the PHP Chinese website!