Skip to content

Proposal for a CSS Structure to Support Country-Specific Style Overrides #7326

@mpruser

Description

@mpruser

Enter your suggestions in details:

Description

To improve the accessibility and readability of the Node.js website for non-English languages, especially Korean, I propose a CSS structure that supports country-specific style overrides. This approach addresses issues such as narrow line spacing and unnatural line breaks, enhancing readability for languages like Korean. By providing a mechanism for locale-specific style customization, we can improve the user experience for all audiences.

Problem

The current CSS structure does not account for the typographic and layout differences required for various languages and locales. For example:

  • Korean (ko): The default line height and text wrapping behavior are not optimized for Korean typography, resulting in cramped text and poor readability.
  • Other languages: Similar issues may arise for other languages or regions, such as Arabic, Japanese, or Chinese.

Introducing a country-specific CSS override mechanism would allow localized adjustments without compromising global design consistency.

Proposed Solution

  1. Add a locals.css file
    • Create a dedicated locals.css file to include locale-specific overrides.
  2. Use the html[lang] attribute
    • Define country-specific styles using the lang attribute:
html[lang='ko'] {  
  overflow-wrap: anywhere;  
  word-break: keep-all;  
  line-height: 1.8;  
}

/* Define other locale-specific styles */  
  1. Update the CSS import structure
    • Include locals.css at the end of the main CSS file:
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
@import './base.css';
@import './markdown.css';
@import './effects.css';
@import './locals.css';

Before and After Comparison

As-Is (Current) To-Be (Proposed)
as-is to-be

Expected Benefits

  • Improved readability for non-English locales, particularly Korean.
  • Enhanced user experience through better typographic adjustments.
  • Flexibility to add and modify styles for additional locales as needed.

Potential Challenges

  • Ensuring that new styles do not unintentionally override global styles.
  • Maintaining consistency across locales while allowing for necessary differences.

This structure provides a clear and scalable solution to address the typographic and layout needs of different languages. If you have any feedback or suggestions, I’d be happy to collaborate further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityIssues concerning accessibilitydesignenhancementi18nIssues/PRs related to the Website Internationalisation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions