# UI Styling Standards ## Overview Standards and conventions for CSS frameworks, responsive design, and styling best practices in frontend development. ## Quick Reference **Framework**: Tailwind CSS + Flowbite (default) **Approach**: Mobile-first responsive **Format**: Utility-first CSS **Specificity**: Use `!important` for overrides when needed --- ## CSS Framework Conventions ### Tailwind CSS **Loading Method** (Preferred): ```html ``` **Avoid**: ```html ``` **Why**: Script tag allows for JIT compilation and configuration ### Flowbite **Loading Method**: ```html ``` **Usage**: Flowbite is the default component library unless user specifies otherwise **Components Available**: - Buttons, forms, modals - Navigation, dropdowns, tabs - Cards, alerts, badges - Tables, pagination - Tooltips, popovers --- ## Responsive Design Requirements ### Mobile-First Approach **Rule**: ALL designs MUST be responsive **Breakpoints** (Tailwind defaults): ```css /* Mobile first - base styles apply to mobile */ .element { } /* Small devices (640px and up) */ @media (min-width: 640px) { } /* sm: */ /* Medium devices (768px and up) */ @media (min-width: 768px) { } /* md: */ /* Large devices (1024px and up) */ @media (min-width: 1024px) { } /* lg: */ /* Extra large devices (1280px and up) */ @media (min-width: 1280px) { } /* xl: */ /* 2XL devices (1536px and up) */ @media (min-width: 1536px) { } /* 2xl: */ ``` **Tailwind Syntax**: ```html
Body text
Secondary text
Caption text
``` ### Font Loading **Always use Google Fonts**: ```html ``` **Apply in CSS**: ```css body { font-family: 'Inter', sans-serif !important; } ``` ### Readability - **Line length**: 60-80 characters optimal - **Line height**: 1.5-1.75 for body text - **Font size**: Minimum 16px for body text - **Contrast**: 4.5:1 minimum for normal text --- ## Component Styling Patterns ### Buttons ```html ``` ### Cards ```htmlCard content
Hover for effect
```
### Critical CSS
```html
```
---
## Best Practices
### Do's ✅
- Use Tailwind utility classes for rapid development
- Load Tailwind via script tag for JIT compilation
- Use Flowbite as default component library
- Ensure all designs are mobile-first responsive
- Test at multiple breakpoints
- Use semantic HTML elements
- Provide ARIA labels for interactive elements
- Use CSS custom properties for theming
- Apply `!important` for framework overrides
- Ensure proper color contrast (WCAG AA)
### Don'ts ❌
- Don't use Bootstrap blue without explicit request
- Don't load Tailwind as a stylesheet
- Don't skip responsive design
- Don't use div soup (use semantic HTML)
- Don't forget focus states
- Don't hardcode colors (use theme variables)
- Don't skip accessibility testing
- Don't use tiny touch targets (<44px)
- Don't mix color formats
- Don't over-use `!important`
---
## Framework Alternatives
If user requests a different framework:
**Bootstrap**:
```html
```
**Bulma**:
```html
```
**Foundation**:
```html
```
---
## References
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
- [Flowbite Components](https://flowbite.com/docs/getting-started/introduction/)
- [WCAG Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
- [MDN Web Accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility)