Overview
Portfolio Moretto uses a modern styling stack combining Tailwind CSS for utility-first styling, PostCSS for processing, and custom CSS for global styles and design tokens.Tailwind CSS Setup
Tailwind CSS is configured to scan all relevant files for class names and generate only the CSS you use.Configuration
Thetailwind.config.js file defines what files to scan and theme customizations:
tailwind.config.js
Configuration Breakdown
Content Paths
The
content array tells Tailwind where to look for class names:./index.html- Scans the HTML entry point./src/**/*.{js,ts,jsx,tsx}- Scans all JavaScript/TypeScript files in src/
Only classes found in these files will be included in the final CSS bundle, keeping your stylesheet minimal.
Theme Extension
The
theme.extend object is currently empty but can be used to add custom:- Colors
- Spacing scales
- Breakpoints
- Typography settings
- And more…
PostCSS Configuration
PostCSS processes your CSS with Tailwind and Autoprefixer. Configuration is inpostcss.config.js:
postcss.config.js
What Each Plugin Does
Tailwind CSS
Processes
@tailwind directives and generates utility classes based on your configurationAutoprefixer
Automatically adds vendor prefixes to CSS rules for better browser compatibility
Global Styles
Thesrc/index.css file contains global styles and Tailwind directives:
src/index.css
Understanding the Structure
Tailwind Directives
Tailwind Directives
The three
@tailwind directives inject Tailwind’s styles:- @tailwind base - Reset styles and base element styling
- @tailwind components - Component classes (you can define custom ones)
- @tailwind utilities - All utility classes like
flex,pt-4, etc.
@layer base
@layer base
Custom base styles wrapped in
@layer base get the same specificity as Tailwind’s base styles:- :root - Sets color scheme to dark mode
- body - Applies dark theme colors and typography
- a - Adds smooth color transitions to all links
Design Tokens & Theme
The project uses a dark theme with Tailwind’s slate color palette as the foundation.Color Scheme
Background
bg-slate-950 - Very dark slate for the main backgroundText
text-slate-100 - Light slate for readable text contrastTypography
The project uses a system font stack with Inter as the preferred font:- Inter - Modern, highly readable sans-serif (if loaded)
- system-ui - System’s default UI font
- -apple-system - macOS San Francisco
- BlinkMacSystemFont - macOS/iOS system font
- Segoe UI - Windows system font
- sans-serif - Generic fallback
The
antialiased utility applies -webkit-font-smoothing: antialiased for smoother font rendering on macOS.Transitions
All links have smooth color transitions:Responsive Design Patterns
Tailwind provides responsive utilities using mobile-first breakpoints:Breakpoints
| Prefix | Min Width | Description |
|---|---|---|
sm: | 640px | Small devices |
md: | 768px | Tablets |
lg: | 1024px | Laptops |
xl: | 1280px | Desktops |
2xl: | 1536px | Large screens |
Example Usage
Custom Styles with SCSS
While Tailwind handles most styling, Sass is available for complex component styles:Available in Dependencies
package.json
Creating SCSS Files
Create.scss files in your component directories:
src/components/Example/Example.module.scss
Styling Best Practices
Prefer Tailwind utilities
Use Tailwind classes for most styling needs. They’re optimized, consistent, and easy to maintain.
Use @apply for repeated patterns
When you have complex repeated utility combinations, extract them with
@apply:Keep specificity low
Avoid deeply nested selectors. Tailwind’s utility-first approach naturally keeps specificity flat.
Dark Mode Support
The project is configured for dark mode by default. To add light mode support:Enable Dark Mode in Tailwind
tailwind.config.js
Use Dark Mode Utilities
Toggle Dark Mode
Add a class to the HTML element:Custom Tailwind Utilities
Extend Tailwind with custom utilities in your config:tailwind.config.js
Debugging Styles
Visual Debugging
Add borders to see element boundaries:Tailwind CSS IntelliSense
Install the VS Code extension for autocomplete and class name validation:- Hover to see generated CSS
- Autocomplete for all utilities
- Linting for invalid classes
Browser DevTools
Inspect elements to see which Tailwind classes are applied and their generated CSS.Next Steps
Firebase Integration
Learn how to integrate Firebase for data and storage
Component Guide
Explore the component architecture
Tailwind Docs
Official Tailwind CSS documentation
PostCSS Docs
Learn more about PostCSS
