I am currently working on a next.js project and utilizing tailwind for styling. I have noticed an odd behavior when importing a custom font into my globals.css file.
page.jsx
"use client";
import React from "react";
const page = () => {
return (
<div className=" w-full h-screen flex flex-col justify-center items-center bg-cover bg-center bg-sliding-image ">
<div className={`flex flex-col items-center border `}>
<h1 className="font-greatvibes text-black">The Wedding Of</h1>
</div>
</div>
);
};
export default page;
tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
"sliding-image": "url('../assets/images/slidingimage.jpg')",
},
fontFamily: {
satoshi: ["Satoshi", "sans-serif"],
inter: ["Inter", "sans-serif"],
abhaya: ["Abhaya Libre", "serif"],
cormorant: ["Cormorant", "serif"],
greatvibes: ["Great Vibes", "cursive"],
roboto: ["Roboto", "sans-serif"],
},
colors: {
"primary-orange": "#FF5722",
},
transitionDuration: {
0: "0ms",
3000: "3000ms",
},
},
},
plugins: [],
};
globals.css
@import url("https://fonts.googleapis.com/css2?family=Abhaya+Libre:wght@400;500;600&family=Cormorant:wght@400;500;600&family=Great+Vibes&family=Roboto:wght@400;500;700&display=swap");
@tailwind base;
@tailwind components;
@tailwind utilities;
After importing the font, the appearance differs from when the font is not imported. https://i.stack.imgur.com/norIM.jpg
Any thoughts on why this might be happening? It's quite confusing to me.