Skip to content

Commit 92015b6

Browse files
authored
fix(curriculum): add Tailwind CSS section to FE Libs chapter review (freeCodeCamp#61946)
1 parent 03b4fd4 commit 92015b6

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

curriculum/challenges/english/blocks/review-front-end-libraries/6724e2dbf723fe1c8883cc69.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,99 @@ Here is an example of using Bootstrap to create a list group. Instead of applyin
11471147
</div>
11481148
```
11491149

1150+
## Tailwind CSS
1151+
1152+
Tailwind is a utility-first CSS framework. Instead of writing custom CSS rules, you build your designs by combining small utility classes directly in your HTML.
1153+
1154+
### Responsive Design Utilities
1155+
1156+
Tailwind uses prefixes such as `sm:`, `md:`, and `lg:` to apply styles at different screen sizes.
1157+
1158+
```html
1159+
<div class="w-full md:w-1/2 lg:flex-row">
1160+
Responsive layout
1161+
</div>
1162+
```
1163+
1164+
### Flexbox Utilities
1165+
1166+
Classes like `flex`, `flex-col`, `justify-around`, and `items-center` make it easy to create flexible layouts.
1167+
1168+
```html
1169+
<div class="flex flex-col md:flex-row justify-around items-center">
1170+
<p>Column on small screens</p>
1171+
<p>Row on medium and larger screens</p>
1172+
</div>
1173+
```
1174+
1175+
### Grid Utilities
1176+
1177+
Tailwind includes utilities for CSS Grid, like `grid`, `grid-cols-1`, and `md:grid-cols-3`.
1178+
1179+
```html
1180+
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
1181+
<div class="bg-gray-100 p-4">Column 1</div>
1182+
<div class="bg-gray-100 p-4">Column 2</div>
1183+
<div class="bg-gray-100 p-4">Column 3</div>
1184+
</div>
1185+
```
1186+
1187+
### Spacing Utilities
1188+
1189+
Utilities like `mt-8`, `mx-auto`, `p-4`, and `gap-4` help create consistent spacing without writing CSS.
1190+
1191+
```html
1192+
<div class="mt-8 p-4 bg-indigo-600 text-white">
1193+
Spaced content
1194+
</div>
1195+
```
1196+
1197+
### Typography Utilities
1198+
1199+
Utilities like `uppercase`, `font-bold`, `font-semibold`, and `text-4xl` control text appearance.
1200+
1201+
You can set font sizes that adjust at breakpoints, such as `text-3xl` and `md:text-5xl`.
1202+
1203+
```html
1204+
<h1 class="text-3xl md:text-5xl font-semibold text-center">
1205+
Responsive Heading
1206+
</h1>
1207+
```
1208+
1209+
### Colors and Hover States
1210+
1211+
Tailwind provides a wide color palette, such as `text-red-700`, `bg-indigo-600`, and `bg-gray-100`.
1212+
1213+
Classes like `hover:bg-pink-600` make interactive effects simple.
1214+
1215+
```html
1216+
<a href="#" class="bg-pink-500 hover:bg-pink-600 text-white px-4 py-2 rounded-md">
1217+
Hover Me
1218+
</a>
1219+
```
1220+
1221+
### Borders, Rings, and Effects
1222+
1223+
- **Borders**: `border-2 border-red-300` adds borders with specified thickness and colors.
1224+
- **Rings**: `ring-1 ring-gray-300` creates outline-like effects often used for focus or cards.
1225+
- **Rounded corners and scaling**: Classes like `rounded-md`, `rounded-xl`, and `scale-105` add polish.
1226+
1227+
```html
1228+
<div class="p-6 rounded-xl ring-2 ring-fuchsia-500 scale-105">
1229+
Highlighted card
1230+
</div>
1231+
```
1232+
1233+
### Gradients
1234+
1235+
Tailwind supports gradient utilities like `bg-gradient-to-r from-fuchsia-500 to-indigo-600`.
1236+
1237+
```html
1238+
<div class="p-4 text-white bg-gradient-to-r from-fuchsia-500 to-indigo-600">
1239+
Gradient background
1240+
</div>
1241+
```
1242+
11501243
## CSS Preprocessors
11511244

11521245
- **CSS preprocessor**: A CSS preprocessor is a tool that extends standard CSS. It compiles the code with extended syntax into a native CSS file. It can be helpful for writing cleaner, reusable, less repetitive, and scalable CSS for complex projects.

0 commit comments

Comments
 (0)