Aliases for tailwind classes?

rgc998

I want to change the name of the tailwind hidden class so that whenever I want to use display:none, I can do so by using the word no-display instead of using the word hidden. I am assuming this is a change I can make in the tailwind config file but I can't seem to figure out exactly how and what changes need to be made in that file. Thanks for the help

ChenBr

You can add custom utilities to your tailwind CSS file.


With the @apply directive:

main.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
  .no-display {
    @apply hidden
  }
}

HTML:

<div class="no-display">You can't see this text</div>

Tailwind-play link


With CSS utility:

main.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
  .no-display {
    display: none;
  }
}

HTML:

<div class="no-display">You can't see this text</div>

Tailwind-play link

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Convention to distinguish type aliases from actual classes?

Aliases removed across multiple classes

Tailwind CSS convert more of these inline styles to utility classes

Tailwind css purge removes all dark classes

Tailwind+ Nuxt: @apply doesn't work for all classes

Inheritting type aliases in template classes

use tailwind classes into styled-components

Tailwind css classes not showing in Storybook build

How in Tailwind CSS to use classes with arbitrary values

Disable prettier for Tailwind classes

header alignment with tailwind classes

Does Tailwind CSS remove unused custom CSS classes in production?

Tailwind css 3.0.5 classes is not working with react

Tailwind classes not working with html file

Color classes of Tailwind CSS not working when appended

Tailwind default color classes not working

Tailwind classes not rendering in react app

How can I pass tailwind classes to fontawesome in Angular

vite can't recognize tailwind classes in laravel application

Applying an effect to multiple pseudo classes at once in tailwind

Why my Tailwind classes have stopped working

Tailwind CSS not loading custom classes on React app

Tailwind classes Not Working in nuxt app?

Tailwind CSS is not outputting classes for the background

Using postcss-each to define classes in a tailwind layer

Laravel + Tailwind CSS - Classes not available due to being in Variables

Using Tailwind opacity classes with CSS variables

Add spacing in between items with css tailwind classes

Unable to Apply Tailwind CSS Classes in React Component (TypeScript)