Lesson 3: Utility-First CSS Framework
Grade 11 Web Development
Tailwind CSS is the industry standard in modern web development. It provides complete design control while maintaining consistency and performance.
Unlike traditional frameworks, Tailwind doesn't impose design decisions - it gives you the tools to build exactly what you envision.
Responsive Column 1
This adjusts based on screen size
Responsive Column 2
Mobile: 1 column, Desktop: 3 columns
Responsive Column 3
Built with Tailwind's grid system
p-4, m-2, mt-8
Padding, margin, and gap utilities
bg-blue-500, text-red-600
Background, text, and border colors
text-lg, font-bold
Font size, weight, and alignment
flex, grid-cols-3
Flexbox and Grid utilities
border, rounded-lg
Border styles and radius
shadow-lg, hover:scale-105
Shadows, transitions, transforms
Convert this traditional CSS to Tailwind utility classes:
p-5 mt-4 bg-emerald-500 text-white rounded-xl font-bold text-center shadow-md border border-emerald-600
Try applying these classes to a div element and see the result.
Tailwind uses a mobile-first approach where styles apply to all screen sizes, then you can override them for larger screens.
sm:text-lg
md:flex
lg:w-1/2
xl:grid-cols-4
2xl:container
Create a card component that responds differently on various screen sizes:
This card should be responsive. On mobile it takes full width, on tablet half width, and on desktop one-third width.
Resize your browser window to see the responsiveness.
Based on what you've learned about both frameworks, which would you choose for these projects and why?
Needs to match existing university branding, multiple content editors will maintain it, must be accessible and consistent across all pages.
Unique data visualization needs, complex interactive components, design system needs to be created from scratch, team of 5 developers.
Project A: Bulma - Better for maintaining consistent branding across multiple editors
Project B: Tailwind - Better for custom designs and team collaboration on complex interfaces
You will enhance a basic blog layout using Tailwind CSS. Start with the provided HTML structure and apply Tailwind utility classes to create a modern, responsive blog.
Apply Tailwind CSS to achieve the following:
Create a responsive navigation bar with logo, links, and mobile hamburger menu.
Add a hero section with gradient background, centered title, and call-to-action button.
Create a responsive grid of blog posts (1 column mobile, 2 tablet, 3 desktop).
Design a footer with social links, copyright, and newsletter signup.
container mx-auto for centering contentmd: and lg: prefixes for responsive behaviorhover: prefixflex and grid for layouts