tailwind.config.js文件无法访问tailwind.css文件中指定的字体。我使用的是nuxt.js 3和tailwindcss,非常感谢您的帮助。
tailwind.css
/* /assets/css/tailwind.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
body {
background-color: #16181c;
color: #ecf9fb;
font-family: "Inter", Arial, sans-serif;
margin: 1rem 5%;
}
}
/* Inter Regular 400 */
@font-face {
font-family: "Inter";
src: url("../fonts/inter-regular-400.woff2");
}
/* Solway Bold 700 */
@font-face {
font-family: "Solway";
font-weight: 700;
src: url("../fonts/solway-bold-700.woff2");
}Solway字体的应用是正确的,所以导入它没有问题;将@font-face放在@layer base中不会做任何事情
tailwind.config.js
/* tailwind.config.js */
module.exports = {
content: [
"components/**/*.vue",
"layouts/**/*.vue",
"pages/**/*.vue",
"composables/**/*.{js,ts}",
"plugins/**/*.{js,ts}",
],
theme: {
extend: {
fontFamily: {
solway: ['"Solway" "Inter" Arial sans-serif'],
},
backgroundColor: {
card: ["#26292f"],
},
},
},
plugins: [],
};我是如何尝试使用新字体系列的
// /layouts/default.vue
<template>
<header class="bg-card-0 rounded-2xl p-4 text-2xl">
<NuxtLink to="/" class="font-solway font-bold">Second Hand</NuxtLink>
</header>
<slot />
</template>发布于 2022-09-11 15:39:42
发布于 2022-09-12 13:16:11
错误发生在tailwind.config.js文件中。它是什么:
fontFamily: {
solway: ['"Solway" "Inter" Arial sans-serif'],
},什么是正确的:
fontFamily: {
solway: ["Solway", "Inter", "Arial", "sans-serif"],
},https://stackoverflow.com/questions/73677949
复制相似问题