| Tailwind Class | CSS Property | Vanilla CSS Equivalent | Description |
|---|---|---|---|
| bg-white | background-color |
background-color: #ffffff; |
Sets background color to white. |
| shadow-sm | box-shadow |
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); |
Adds a small shadow under the element. |
| border-b | border-bottom-width |
border-bottom-width: 1px; |
Adds a bottom border. Default color: #e5e7eb (gray-200). |
| max-w-7xl | max-width |
max-width: 80rem; /* 1280px */ |
Restricts container width for large screens. |
| mx-auto | margin-left, margin-right |
margin-left: auto; margin-right: auto; |
Centers the container horizontally. |
| px-4 | padding-left, padding-right |
padding-left: 1rem; padding-right: 1rem; |
Adds horizontal padding (16px). |
| sm:px-6 | Responsive padding (small screens ≥640px) | @media (min-width: 640px) { padding-left: 1.5rem; padding-right: 1.5rem; } |
Increases padding on small screens. |
| lg:px-8 | Responsive padding (large screens ≥1024px) | @media (min-width: 1024px) { padding-left: 2rem; padding-right: 2rem; } |
Increases padding more on large screens. |
| flex | display |
display: flex; |
Enables flexbox layout. |
| justify-between | justify-content |
justify-content: space-between; |
Puts items at start and end of the flex container. |
| items-center | align-items |
align-items: center; |
Vertically centers the flex items. |
| h-16 | height |
height: 4rem; /* 64px */ |
Sets fixed height for the navbar. |
| text-2xl | font-size, line-height |
font-size: 1.5rem; line-height: 2rem; |
Sets large text size. |
| font-bold | font-weight |
font-weight: 700; |
Makes text bold. |
| text-blue-600 | color |
color: #2563EB; |
Sets text color to a medium blue. |
| space-x-4 | margin-left (applied to child elements) |
> * + * { margin-left: 1rem; } |
Adds 16px horizontal space between child elements inside the flex container. |
If condition is true → use valueIfTrue If condition is false → use valueIfFalse ✅ Your amenity example Your code: {amenity === 'wifi' ? 'WIFI' : amenity} Breakdown: ✔ Condition: amenity === 'wifi' This checks: “Is the current amenity equal to 'wifi'?” ✔ If condition is TRUE → show: 'WIFI' ✔ If condition is FALSE → show: amenity 🎯 Example with your amenitiesList const amenitiesList = [ 'wifi' , 'parking' , 'kitchen' ]; Looping through each item: 🔹 1. amenity = "wifi" Check condition: 'wifi' === 'wifi' → TRUE So ternary returns: 'WIFI' 👉 Display: WIFI 🔹 2. amenity = "parking" Check condition: 'parking' === 'wifi' → FALSE So ternary returns: amenity // which is "parking" 👉 Display: parking 🔹 3. amenity = "kitchen" Check condition: 'kitchen' === 'wifi' → FALS...
Comments
Post a Comment