Utilities for controlling word breaks in an element.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiisitaquequodpraesentiumexplicaboincidunt? Dolores beatae nam at sed dolorum ratione dolorem nisi velit cum.
<p class="break-normal ...">...</p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiisitaquequodpraesentiumexplicaboincidunt? Dolores beatae nam at sed dolorum ratione dolorem nisi velit cum.
<p class="break-words ...">...</p>
Use break-all
to add line breaks whenever necessary, without trying to preserve whole words.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiisitaquequodpraesentiumexplicaboincidunt? Dolores beatae nam at sed dolorum ratione dolorem nisi velit cum.
<p class="break-all ...">...</p>
To control the word breaks in an element only at a specific breakpoint, add a {screen}:
prefix to any existing word break utility. For example, adding the class md:break-all
to an element would apply the break-all
utility at medium screen sizes and above.
<p class="break-normal md:break-all ...">
<!-- ... -->
</p>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
By default, only responsive variants are generated for word break utilities.
You can control which variants are generated for the word break utilities by modifying the wordBreak
property in the variants
section of your tailwind.config.js
file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ wordBreak: ['hover', 'focus'],
}
}
}
If you don't plan to use the word break utilities in your project, you can disable them entirely by setting the wordBreak
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ wordBreak: false,
}
}