フォント名とパスを指定する
/* ttfファイル(事前にpublicに置く) */
@font-face {
font-family: "FontFile";
src: url("../../public/fonts/FontFile.ttf");
}
/* Google Fonts */
@font-face {
font-family: "Rampart_One";
src: url("https://fonts.googleapis.com/css2?family=Rampart+One&display=swap");
}
fontFamilyに追記
import type { Config } from "tailwindcss";
const config: Config = {
content: [],
theme: {
extend: {
fontFamily: {
file: ["FontFile", "sans-serif"],
rampart: ["Rampart_One", "sans-serif"],
},
},
},
};
export default config;
classNameに[font-〇〇]で指定します。
<div className="font-file"> あいうえお</div>
<div className="font-rampart"> あいうえお</div>