0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

TailwindCSSのカスタマイズ

Last updated at Posted at 2020-08-17

はじめに

普段tailwindを使っていますが、カスタムする機会がありました。
業務でmin-width-10remを使いたいと思いましたが、、、スクリーンショット 0002-08-17 18.41.07.png
tailwindCSSには2つしかありません。カスタムをする必要があります。

修正方法

まずtailwind.config.jsを開き、追加したいものを以下のように書きます。
extendがないとデフォルトの値は消え、使用できない。

tailwind.config.js
module.exports = {
 theme={
  extend:{ 
   minWidth: {
    '40': '10rem',
   }
  }
 }
}

使用例

image.tsx
<div className = {'min-w-40'}>
 <img src = 'https://qiita.jpg' alt='qiita'>
</div>

まとめ

module.exports>theme下でカスタマイズ可能

tailwind.config.js
module.exports = {
 theme={
  extend:{ // extendによりデフォルトのCSSは保たれる
   minWidth: {
    // ここにカスタムしたい内容を入れる
   }
  }
 }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?