Tailwind Concepts and Common Classes
Some Concepts
Spacing
These rules control the padding and margin of elements. Examples include p-4 (adds padding on all sides of an element) and my-6 (adds margin on the top and bottom of an element).
Colors
These rules control the color of elements. Examples include text-blue-500 (sets the text color to blue) and bg-yellow-400 (sets the background color to yellow).
Typography
These rules control the font size, font weight, and other typography-related styles of elements. Examples include text-xl (increases the font size) and font-bold (increases the font weight).
Layout
These rules control the layout and position of elements. Examples include flex (sets an element to display as a flex container) and absolute (sets an element to be positioned absolutely).
Sizing
These rules control the size of elements. Examples include w-full (sets the width of an element to 100%) and h-24 (sets the height of an element to 24 units).
Other
There are many other types of rules available in Tailwind CSS, such as rules for controlling borders, rounded corners, transitions, and more
Important classes
w-* These classes control the width of an element. For example, w-1/2 would make the element take up half of the available width.
h-*: These classes control the height of an element. For example, h-12 would make the element 12 units tall.
text-*: These classes control the text styling of an element. For example, text-xl would make the text larger than the default size.
font-*: These classes control the font family of an element. For example, font-sans would apply a sans-serif font to the element.
bg-*: These classes control the background color of an element. For example, bg-blue-500 would apply a blue color to the element's background.
rounded-*: These classes control the border radius of an element. For example, rounded-full would make the element a circle.
shadow-*: These classes control the shadow effect of an element. For example, shadow-md would apply a medium shadow to the element.
text-center: This class aligns the text in an element to be centered.
block px-4 py-2 rounded-lg bg-gray-400 hover:bg-gray-500
This class applies multiple styles to an element at once. It creates a block-level element with padding on the left and right sides, padding on the top and bottom, a large border radius, and a gray background color. When the element is hovered over, the background color changes to a slightly darker shade of gray.
flex items-center justify-between This class applies the flex layout to an element and aligns the child elements within it to be centered vertically and horizontally justified.