Tailwind CSS

Prefix


A prefix in Tailwind CSS is a personalized string that you can attach at the start of all the utility classes Tailwind generates. This feature proves handy when merging Tailwind with your existing CSS styles, as it helps prevent clashes between Tailwind's classes and your pre-existing styles.

 

By default, Tailwind CSS does not add any prefix to its classes. For example, to set text alignment to the left, you would simply use the class text-left. However, if you already have a class named text-left in your existing styles, it could lead to conflicts.

 

You have the option to set Tailwind to include a prefix, like 'tx-', for all its classes. Therefore, the class 'text-left' would transform into 'tx-text-left'. This approach effectively avoids conflicts with your existing 'text-left' class.

How to configure Tailwind file ? 
In `tailwind.config.js`
 

module.exports = {
	prefix: "tx-",
};

 

Note:

Prefix serve as shorthand notations to apply utility classes responsively across different breakpoints.