by vishnuharidas · 1y ago · 0 comments
Absolute takes the element out of the flow while relative maintains it in the flow.
• this name works with Grid and Flexbox
• this convention matches justify-items and justify-self, which makes sense
to your point I still confuse it with align-content sometimes.
It's also not zero based which I always forget.
const plugin = require('tailwindcss/plugin')
const aliasFlexboxAlignment = plugin(function({ addUtilities }) {
addUtilities({
'.cross-axis-baseline': { 'align-items': 'baseline' },
'.cross-axis-center': { 'align-items': 'center' },
'.cross-axis-end': { 'align-items': 'flex-end' },
'.cross-axis-start': { 'align-items': 'flex-start' },
'.cross-axis-stretch': { 'align-items': 'stretch' },
'.main-axis-around': { 'justify-content': 'space-around' },
'.main-axis-between': { 'justify-content': 'space-between' },
'.main-axis-center': { 'justify-content': 'center' },
'.main-axis-end': { 'justify-content': 'flex-end' },
'.main-axis-evenly': { 'justify-content': 'space-evenly' },
'.main-axis-normal': { 'justify-content': 'normal' },
'.main-axis-start': { 'justify-content': 'flex-start' },
})
})I also like Tailwind because it’s so self-documenting. Even if Tailwind’s development were to stop, tomorrow, and all of the style sheets were lost globally, I would know what everything is meant to be.
Sure you can change that. But that covers the flex default behavior.