| name | css-styling-standards |
| description | CSS styling standards and best practices for responsive, accessible, and maintainable web interfaces with special considerations for multilingual content and Chuukese text display. Includes Mantine UI v8 integration for React components. Use when creating or modifying stylesheets and CSS components. Use when this capability is needed. |
| metadata | {"author":"findinfinitelabs"} |
CSS Styling Standards
Core Principles
- Mobile-first design: Start with mobile styles, enhance for larger screens
- Accessibility compliance: Meet WCAG 2.1 AA standards
- Multilingual support: Proper display of accented characters and different writing systems
- Consistent naming: Use BEM methodology for class naming (unless using Mantine)
- Performance optimization: Minimize CSS size and loading time
- Mantine Integration: Use Mantine UI v8 component system for React frontend
Mantine UI v8 Integration
1. Theme Configuration
import { createTheme, MantineColorsTuple } from '@mantine/core';
const primaryBlue: MantineColorsTuple = [
'#e5f4ff',
'#cde4ff',
'#9bc5ff',
'#64a4ff',
'#3988fe',
'#1d77fe',
'#096fff',
'#005ee4',
'#0053cd',
'#0047b5',
];
export const theme = createTheme({
primaryColor: 'blue',
colors: {
blue: primaryBlue,
},
fontFamily: "'Noto Sans', 'Arial Unicode MS', sans-serif",
headings: {
fontFamily: "'Noto Sans', 'Arial Unicode MS', sans-serif",
fontWeight: '600',
},
defaultColorScheme: 'dark',
components: {
Text: {
defaultProps: {
style: {
fontFeatureSettings: "'kern' 1, 'liga' 1"
}
}
},
TextInput: {
defaultProps: {
styles: {
input: {
fontFamily: "'Noto Sans', 'Arial Unicode MS', sans-serif",
}
}
}
},
Textarea: {
defaultProps: {
styles: {
input: {
fontFamily: "'Noto Sans', 'Arial Unicode MS', sans-serif",
lineHeight: 1.6,
}
}
}
}
}
});
2. Mantine Provider Setup
import '@mantine/core/styles.css';
import '@mantine/notifications/styles.css';
import { MantineProvider } from '@mantine/core';
import { Notifications } from '@mantine/notifications';
import { ModalsProvider } from '@mantine/modals';
import { theme } from './theme';
function App() {
return (
<MantineProvider theme={theme} defaultColorScheme="dark">
<Notifications position="top-right" />
<ModalsProvider>
{/* App content */}
</ModalsProvider>
</MantineProvider>
);
}
3. Chuukese Text with Mantine
import { Text, Title, Badge, Card } from '@mantine/core';
function ChuukeseWord({ word, definition }: { word: string; definition: string }) {
return (
<Card shadow="sm" padding="lg" radius="md" withBorder>
<Title order={3} style={{ fontFeatureSettings: "'kern' 1" }}>
{word}
</Title>
<Text c="dimmed" size="sm" mt="xs">
{definition}
</Text>
</Card>
);
}
function TranslationInput({ direction }: { direction: 'chk_to_en' | 'en_to_chk' }) {
return (
<Textarea
= === ? ' ' ' '}
= ===
? ' '
' '}
=
=
{
"' ', ' ', ",
'',
}
}}
/>
);
}
4. Common Mantine Patterns
import { Loader, Center, Stack, Text } from '@mantine/core';
<Center h={200}>
<Stack align="center">
<Loader size="lg" />
<Text c="dimmed">Translating...</Text>
</Stack>
</Center>
import { notifications } from '@mantine/notifications';
notifications.show({
title: 'Translation Complete',
message: 'Your text has been translated successfully',
color: 'green',
});
import { modals } from '@mantine/modals';
modals.openConfirmModal({
title: 'Delete Entry',
children: <Text>Are you sure you want to delete this entry?</Text>,
labels: { confirm: , : },
: { : },
: (),
});
CSS Architecture (Non-Mantine Styles)
1. File Organization
@import 'normalize.css';
@import 'variables.css';
@import 'typography.css';
@import 'layout.css';
@import 'components.css';
@import 'utilities.css';
@import 'responsive.css';
2. CSS Custom Properties (Variables)
:root {
--primary-color: #228be6;
--secondary-color: #64748b;
--accent-color: #f59e0b;
--text-color: #c1c2c5;
--text-light: #909296;
--background-color: #1a1b1e;
--surface-color: #25262b;
--font-family-primary: 'Noto Sans', 'Arial Unicode MS', sans-serif;
--font-family-chuukese: 'Noto Sans', 'Doulos SIL', 'Arial Unicode MS', sans-serif;
--font-size-base: 1rem;
--font-size-large: 1.125rem;
--line-height-base: 1.6;
--line-height-tight: 1.4;
--spacing-xs: 0.625rem;
--spacing-sm: 0.75rem;
--spacing-md: 1rem;
--spacing-lg: 1.25rem;
--spacing-xl: 2rem;
: ;
: ;
: ;
: ;
: ;
}
{
: ;
: ;
: ;
}
{
: ;
: ;
: ;
}
Component Standards
1. Chuukese Text Display
.chuukese-text {
font-family: var(--font-family-chuukese);
font-size: var(--font-size-large);
line-height: var(--line-height-base);
direction: ltr;
unicode-bidi: embed;
font-feature-settings: 'kern' 1, 'liga' 1;
}
.chuukese-text--heading {
font-weight: 600;
letter-spacing: 0.02em;
margin-bottom: var(--spacing-md);
}
.chuukese-text--inline {
font-style: italic;
font-weight: 500;
color: var(--primary-color);
}
2. Translation Interface Components
.translation-input {
width: 100%;
min-height: 120px;
padding: var(--spacing-md);
border: 2px solid var(--surface-color);
border-radius: 0.5rem;
font-family: var(--font-family-chuukese);
font-size: var(--font-size-base);
line-height: var(--line-height-base);
resize: vertical;
transition: border-color 0.2s ease-in-out;
}
.translation-input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px hsla(217, 91%, 60%, 0.1);
}
.translation-input--chuukese {
direction: ltr;
text-align: left;
}
.translation-input--error {
border-color: #ef4444;
}
3. Dictionary Entry Component
.dictionary-entry {
background: var(--background-color);
border: 1px solid var(--surface-color);
border-radius: 0.5rem;
padding: var(--spacing-lg);
margin-bottom: var(--spacing-md);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: box-shadow 0.2s ease-in-out;
}
.dictionary-entry:hover {
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.dictionary-entry__word {
font-size: 1.25rem;
font-weight: 600;
color: var(--primary-color);
margin-bottom: var(--spacing-sm);
}
.dictionary-entry__definition {
color: var(--text-color);
margin-bottom: var(--spacing-sm);
}
.dictionary-entry__pronunciation {
: , monospace;
: ;
: (--text-light);
: (--surface-color);
: (--spacing-xs) (--spacing-sm);
: ;
: inline-block;
}
{
: italic;
: (--text-light);
: solid (--accent-color);
: (--spacing-sm);
: (--spacing-sm);
}
Layout Standards
1. Grid System
.grid {
display: grid;
gap: var(--spacing-md);
}
.grid--2-col {
grid-template-columns: 1fr 1fr;
}
.grid--3-col {
grid-template-columns: repeat(3, 1fr);
}
.grid--auto-fit {
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
@media (max-width: 768px) {
.grid--2-col,
.grid--3-col {
grid-template-columns: 1fr;
}
}
2. Container and Spacing
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 var(--spacing-md);
}
@media (min-width: 768px) {
.container {
padding: 0 var(--spacing-lg);
}
}
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
Responsive Design
1. Mobile-First Media Queries
.navigation {
display: flex;
flex-direction: column;
padding: var(--spacing-sm);
}
@media (min-width: 768px) {
.navigation {
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: var(--spacing-md);
}
}
@media (min-width: 1024px) {
.navigation {
padding: var(--spacing-lg);
}
}
2. Responsive Typography
.heading-1 {
font-size: clamp(1.75rem, 4vw, 2.5rem);
font-weight: 700;
line-height: var(--line-height-tight);
margin-bottom: var(--spacing-lg);
}
.heading-2 {
font-size: clamp(1.5rem, 3vw, 2rem);
font-weight: 600;
line-height: var(--line-height-tight);
margin-bottom: var(--spacing-md);
}
.chuukese-text {
font-size: clamp(1rem, 2.5vw, 1.125rem);
}
@media (max-width: 480px) {
.chuukese-text {
font-size: 1.125rem;
}
}
Accessibility Standards
1. Focus Management
.btn:focus,
.form-input:focus,
.translation-input:focus {
outline: 2px solid var(--primary-color);
outline-offset: 2px;
}
@media (prefers-contrast: high) {
.btn:focus,
.form-input:focus {
outline: 3px solid #000;
outline-offset: 2px;
}
}
2. Color and Contrast
:root {
--text-contrast-ratio: 4.5;
}
@media (prefers-contrast: high) {
:root {
--primary-color: #000;
--text-color: #000;
--background-color: #fff;
--surface-color: #f0f0f0;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
Utility Classes
1. Common Utilities
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-muted { color: var(--text-light); }
@media (min-width: 768px) {
.d-md-block { display: block; }
.d-md-none { display: none; }
.text-md-left { text-align: left; }
.text-md-center { text-align: center; }
}
Best Practices
1. Performance Optimization
- Use CSS custom properties for consistent theming
- Minimize the use of expensive properties (box-shadow, gradients)
- Optimize for critical rendering path
- Use efficient selectors (avoid deep nesting)
2. Maintainability
- Follow BEM naming convention
- Group related styles together
- Comment complex or non-obvious styles
- Use meaningful variable names
3. Cross-Browser Compatibility
- Test in major browsers (Chrome, Firefox, Safari, Edge)
- Use autoprefixer for vendor prefixes
- Provide fallbacks for modern CSS features
- Test with different font settings
4. Multilingual Considerations
- Support for RTL languages if needed
- Font stack that supports Unicode characters
- Proper spacing for accented characters
- Consider text expansion/contraction in different languages
Validation Criteria
CSS should:
- โ
Pass W3C CSS validation
- โ
Meet WCAG 2.1 AA accessibility standards
- โ
Display correctly across major browsers
- โ
Support proper Chuukese text rendering
- โ
Follow consistent naming conventions
- โ
Include responsive breakpoints
- โ
Optimize for performance and loading speed
Converted and distributed by TomeVault โ claim your Tome and manage your conversions.