Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

add font in tailwindcss

//add neccessary font in globalstyled.css which is import in main file
//globalStyle.css
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@200;300;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,200;0,300;0,400;0,700;1,100;1,500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;800&family=Raleway:ital,wght@0,200;0,300;0,400;0,700;0,900;1,100;1,500&display=swap')
//in tailwind.config.js
module.exports = {
  content: ['./src/**/*.{js,jsx,ts,tsx}'],
  theme: {
    extend: {
      fontFamily: {
        Montserrat: ['Montserrat', 'sans-serif'],
        Raleway: ['Raleway', 'sans-serif'],
      }, //end of fontFamily
    },
  },
  plugins: [],
}


//and you can use in any where
<button className="font-Raleway">Learn how</button>
Comment

how to add custom font in tailwind css

//import the font into your CSS file using the @font-face CSS rule like so:
// globals.css
@tailwind base;
@tailwind components;
@tailwind utilities;

@font-face {
  font-family: "ADELIA";
  src: url("../public/fonts/ADELIA.otf");
}


// tailwind.config.js
module.exports = {
  content: [
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {
      fontFamily: {
        poppins: ["Poppins", "sans-serif"],
        adelia: ["ADELIA", "cursive"],
      },
    },
  },
  plugins: [],
};

Comment

custom font family tailwind

// Main CSS file
// Add Google Fonts Import

// ---style.css---
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap');


// ---tailwind.config.js----
module.exports = {
  content: [],
  theme: {
    fontFamily: {
      // Add your custom fonts and enjoy.
      'Inter': ["Inter", "Sans-serif"]
    },
    extend: {},
  },
  plugins: [],
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: get a span inside a div with div id javascript 
Typescript :: serenity.is disable row in grid 
Typescript :: yarn run test yarn run v1.22.17 error Command "test" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 
Typescript :: list commits in git 
Typescript :: react handlesubmit typescript 
Typescript :: (change) on select not working in mat-select 
Typescript :: adonis query delete 
Typescript :: google sheets return number of unique items 
Typescript :: node redis new objects must be created at the root 
Typescript :: git writing objects slow 
Typescript :: react native status bar iphone 12 
Typescript :: Display digital clock in angular 
Typescript :: kotlin toast.makeText non of the arguments supplied 
Typescript :: global d ts 
Typescript :: styled components last child 
Typescript :: how to reset stats in diablo 2 
Typescript :: aws sts get-caller-identity extract account 
Typescript :: ion input ngmodel not working ionic 6 
Typescript :: typescript input 
Typescript :: loaded because running scripts is disabled on this s 
Typescript :: union of two sets python syntax 
Typescript :: colorize brackets vscode 
Typescript :: Could not find Angular Material core theme. Most Material components may not work as expected 
Typescript :: reactive form programmatically set value 
Typescript :: typescript remove whitespace from string 
Typescript :: running scripts is disabled on this system 
Typescript :: contents links python jupyter 
Typescript :: get key of enum typescript 
Typescript :: mat-form-field email validation 
Typescript :: copy text from file to another file in javascript with fs 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =