1. Goals
- Provide a complete and lightweight base CSS file, designed from the start to improve user experience and accessibility.
- Offer a modern alternative to traditional base files (reset.css, normalize.css, etc.).
browserux.css is a minimalist CSS foundation focused on user experience and accessibility. Designed to enhance the native behavior of HTML and CSS, it provides a modern, consistent base that improves usability across all devices.
Whether you're building a static site or a modern front-end project, browserux.css
integrates easily with any workflow.
Here are three simple ways to add it to your project:
You can include the latest version directly via jsDelivr:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Effeilo/browserux.css/browserux.css">
You can also download the following file:
browserux.css
Then include him locally in your project:
npm install browserux.css
You can also install browserux.css
via npm for better integration with modern workflows (Vite, Webpack, Parcel, etc.):
<link rel="stylesheet" href="/path/to/browserux.css">
Once installed, you can import it into your project:
<link rel="stylesheet" href="./node_modules/browserux.css/browserux.css">
If your build tool supports CSS imports (like Vite, Webpack, etc.), you can directly import the CSS file in your JavaScript entry point:
import 'browserux.css/browserux.css';
This method ensures that the CSS is bundled with your final build and benefits from your build process (optimization, minification, etc.).
Method | File | Use case |
---|---|---|
CDN | browserux.css | Quick tests |
Local | /assets/css/browserux.css | Custom development, modifications |
npm install | browserux.css via node_modules | Integration with a bundler |
The "CSS Variables" section of browserux.css centralizes all core values used throughout the stylesheet. This enables the creation of a consistent design system that is easily customizable (light/dark themes, accessibility, usability...).
The variables are declared in :root
, which ensures global scope. Their purposes include:
Variables used as the base for the overall theme: background colors, text colors, and primary/secondary accent colors.
Variable | Description | Value |
---|---|---|
--bux-page-bg | Main background color | #eaeaea |
--bux-page-color | Main text color | #121212 |
--bux-color-primary | Primary color (accent/CTA) | #f05e0e |
--bux-color-secondary | Secondary color (links, components) | #0e93f0 |
--bux-transparent | Universal transparent value | transparent |
Defines the colors used for valid/invalid form fields, as well as their corresponding placeholders.
Variable | Description | Value |
---|---|---|
--bux-valid-border-color | Border of valid fields | #29b94c |
--bux-valid-bg-color | Background of valid fields | #f0fff5 |
--bux-invalid-border-color | Border of invalid fields | #dc303e |
--bux-invalid-bg-color | Background of invalid fields | #fff0f0 |
--bux-placeholder-color | Default placeholder color | #aaa |
--bux-invalid-placeholder-color | Placeholder color for invalid state | #dc303e |
Customizes the native <progress>
element to match the theme interface.
Variable | Description | Value |
---|---|---|
--bux-progress-bar-bg | Background of the <progress> bar |
#efefef |
--bux-progress-value-bg | Filled portion inside <progress> |
#29b94c |
Controls the appearance of text selected by the user.
Variable | Description | Value |
---|---|---|
--bux-selection-bg | Background color for selection | var(--bux-page-color) |
--bux-selection-color | Text color for selection | var(--bux-page-bg) |
--bux-selection-text-shadow | Text shadow on selected text | none |
Enables customization of scrollbars for better visual integration (supported in WebKit/Blink).
Variable | Description | Value |
---|---|---|
--bux-scrollbar | Global scrollbar background color | var(--bux-page-bg) |
--bux-scrollbar-track | Track color | #ddecf6 |
--bux-scrollbar-thumb | Thumb color | var(--bux-color-secondary) |
--bux-scrollbar-thumb-hover | Thumb hover color | var(--bux-color-primary) |
--bux-scrollbar-vertical-width | Vertical scrollbar width | 10px |
--bux-scrollbar-horizontal-height | Horizontal scrollbar height | 10px |
Base variables used to configure font, text size, and global line height.
Variable | Description | Value |
---|---|---|
--bux-typo-font-family | Main document font | Système + fallback |
--bux-typo-font-family-mono | Monospace font (for code, pre, etc.) | Monospace standard |
--bux-typo-font-size | Base size (rem) | 1.6rem |
--bux-typo-line-height | Line height | 1.6 |
The browserux.css
file takes into account certain system-level user preferences to improve ergonomics and accessibility, all without JavaScript.
prefers-color-scheme
)Users can enable dark mode at the OS or browser level. This section dynamically adjusts CSS variables to reflect that preference.
@media (prefers-color-scheme: dark) {
:root {
/* Exemples : */
--bux-page-bg: #121212;
--bux-page-color: #eaeaea;
--bux-color-primary: #f05e0e;
--bux-color-secondary: #0e93f0;
/* etc. */
}
}
♿ Accessibility and 🧩 Usability
Enables a soft transition when switching between light and dark themes (automatically or manually):
body {
transition: background-color 0.3s, color 0.3s;
}
🧩 Usability
prefers-reduced-motion
)Some users prefer reduced motion to avoid distractions or unpleasant effects caused by animations.
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0s !important;
animation-iteration-count: 1 !important;
scroll-behavior: auto !important;
transition-duration: 0s !important;
}
}
Effects applied:
Property | Targeted Effect |
---|---|
animation-duration: 0s | Disables animations |
animation-iteration-count: 1 | Stops infinite loops |
scroll-behavior: auto | Disables smooth scrolling |
-transition-duration: 0s | Disables transition effects |
♿ Accessibility
scroll-behavior)
If the user hasn’t disabled animations, smooth scrolling is enabled across the document (anchor links, navigation, etc.).
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
🧩 Usability
These preferences are natively handled by CSS, no scripts needed, and contribute to a smooth, inclusive, and modern user experience.
prefers-reduced-motion
? Check out our full article on the blog:prefers-contrast
)Users can indicate a preference for enhanced visual contrast, usually through their operating system settings (Windows, macOS, etc.). This CSS section improves the readability of interface elements that are often too subtle by default.
@media (prefers-contrast: more) {
Activates this block only if the user has explicitly requested increased contrast.
::placeholder {
color: rgba(16, 16, 16, 0.8);
opacity: 1;
}
::placeholder
: Targets placeholder text in form fields (input
, textarea
, etc.).color: rgba(16, 16, 16, 0.8);
: Applies a dark gray tone with slight transparency to increase contrast while remaining visually distinct from actual input content.opacity: 1;
: Some browsers apply reduced opacity by default, this line ensures full opacity for consistent legibility.
[disabled] {
color: rgba(16, 16, 16, 0.8);
}
[disabled]
: Targets any HTML element with thedisabled
attribute (inputs, buttons, selects, etc.).color: rgba(16, 16, 16, 0.8);
: Prevents these elements from appearing overly faded or hard to see, while still clearly indicating their disabled state.
::selection {
text-shadow: none;
}
::selection
: Customizes the appearance of text when selected (via mouse or keyboard).text-shadow: none;
: Removes any shadow or glow effect (often used in dark themes) that could reduce text clarity in high-contrast modes.
em,
i,
small {
font-weight: bold;
}
em
, i
: These tags typically render emphasized text in italic, which can become hard to read under high-contrast conditions.small
: Reduces text size, making it potentially difficult to read.font-weight: bold;
:Visually reinforces these elements to improve accessibility without altering their semantic meaning.prefers-contrast
.prefers-color-scheme
for fully adaptive theming based on user preferences.♿ Accessibility and 🧩 Usability
prefers-contrast
? Check out our full article on the blog:The "Browser UI Theme" section of browserux.css customizes several native browser elements, such as text selection, scrollbars, form components, or collapsible elements, to improve visual consistency, usability, and accessibility.
::selection
)Customizes the appearance of text selected by the user (background, color, shadow).
::selection {
background: var(--bux-selection-bg);
color: var(--bux-selection-color);
text-shadow: var(--bux-selection-text-shadow);
}
🧩 Usability
Customizes native scrollbars to provide a more consistent appearance across browsers. Supports WebKit/Blink (Chrome, Safari, Edge Chromium) and Firefox (Gecko).
@supports (-moz-appearance: none) {
html {
scrollbar-color: var(--bux-scrollbar-thumb) var(--bux-scrollbar-track);
scrollbar-width: auto;
}
}
::-webkit-scrollbar {
background: var(--bux-scrollbar);
height: var(--bux-scrollbar-horizontal-height);
width: var(--bux-scrollbar-vertical-width);
}
::-webkit-scrollbar-thumb {
background-color: var(--bux-scrollbar-thumb);
}
::-webkit-scrollbar-thumb:hover {
background-color: var(--bux-scrollbar-thumb-hover);
}
Removes unnecessary buttons and corners for a cleaner appearance.
::-webkit-scrollbar-button {
display: none;
}
::-webkit-scrollbar-corner {
background: transparent;
}
By aligning scrollbars with the global theme, visual consistency and user comfort are improved across all modern browsers.
🧩 Usability
This section enhances the appearance and readability of native form components (checkbox, radio, range, select, progress, etc.) by customizing accent colors, validation states, placeholders, and sliders. It aims for better visual consistency without compromising accessibility.
Customizes the color of hint text in empty fields (::placeholder
).
::placeholder {
color: var(--bux-placeholder-color);
}
🧩 Usability
accent-color
)Applies the theme’s primary color to supported form elements.
input[type="checkbox"],
input[type="radio"],
input[type="range"],
meter,
select {
accent-color: var(--bux-color-primary);
}
progress {
accent-color: var(--bux-progress-value-bg);
}
🧩 Usability
range
SliderCustomizes the thumb (slider handle) of the range
input component in WebKit and Firefox.
input[type="range"]::-webkit-slider-thumb,
input[type="range"]::-moz-range-thumb {
background: var(--bux-color-primary);
border: none;
}
🧩 Usability
Modifies the appearance of valid or invalid fields (border, background, placeholder).
input:valid,
textarea:valid,
select:valid {
background-color: var(--bux-valid-bg-color);
border-color: var(--bux-valid-border-color);
}
input:invalid,
textarea:invalid,
select:invalid {
background-color: var(--bux-invalid-bg-color);
border-color: var(--bux-invalid-border-color);
}
input:invalid::placeholder,
textarea:invalid::placeholder {
color: var(--bux-invalid-placeholder-color);
}
♿ Accessibility and 🧩 Usability
progress
)Unifies the native appearance of progress bars in WebKit and Firefox.
progress::-webkit-progress-bar {
background-color: var(--bux-progress-bar-bg);
border-radius: 8px;
}
progress::-webkit-progress-value {
background-color: var(--bux-progress-value-bg);
border-radius: 8px;
}
progress::-moz-progress-bar {
background-color: var(--bux-progress-bar-bg);
}
🧩 Usability
This section improves the appearance of native HTML details
and summary
elements, often used to create accessible accordion-like components without JavaScript.
It applies the theme’s accent color to maintain visual consistency with other form elements.
accent-color
)Applies the theme’s primary color to native arrows and markers (notably in Safari/Chrome).
⚠️ accent-color
only works in Safari/macOS and iOS to style the
summary
arrow. Other browsers (Chrome, Edge, Firefox) ignore this property on these elements.
For consistent cross-browser styling, use summary::marker
or a custom icon via (::before
).
details,
summary {
accent-color: var(--bux-color-primary);
}
🧩 Usability
This section manages the appearance of the outline
focus ring to improve
keyboard accessibility without interfering with mouse interactions.
It uses the :focus-visible
pseudo-class, which allows distinguishing keyboard navigation from mouse or touch input.
:focus {
outline: none;
}
🧩 Usability
:focus-visible
)Displays a visible focus ring only during keyboard use, making accessible navigation easier.
:focus-visible {
outline: 2px solid var(--bux-color-primary);
outline-offset: 2px;
}
♿ Accessibility
This section forms the ergonomic and typographic foundation of browserux.css
.
It draws inspiration from modern resets (like normalize.css), while going further in terms of usability, accessibility, and UX best practices.
This section removes all default margin
and padding
applied by browsers to HTML elements.
This creates a clean, predictable base, essential for any custom stylesheet.
*,
*::before,
*::after {
margin: 0;
padding: 0;
}
🔄 Reset
By default, browsers use content-box
, which can make sizing unpredictable when borders and padding are involved.
This section applies border-box
globally, making dimension calculations more intuitive and consistent.
box-sizing
Ensures that all elements inherit the value defined on html
.
*,
::before,
::after {
box-sizing: inherit;
}
🔄 Reset
html
Root Element Makes width and height calculations more predictable throughout the entire document.
html {
box-sizing: border-box;
}
⚙️ Normalization
This section sets the global behavior of the HTML document starting from the
html
. element.
It configures typography, minimum height, font rendering, scrolling, and mobile ergonomics to establish a stable, consistent, and accessible foundation.
html {
font-family: var(--bux-typo-font-family);
font-size: 62.5%;
min-height: 100%;
overflow-y: scroll;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: transparent;
tab-size: 4;
-moz-tab-size: 4;
text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
Ensures uniform typography across browsers, instead of relying on the system default font which can vary between operating systems.
font-family: var(--bux-typo-font-family);
⚙️ Normalization
Defines a base of 1rem = 10px to simplify calculations (e.g., 1.6rem = 16px). This is a readability convention, not a reset.
font-size: 62.5%;
🧩 Usability and ♿ Accessibility
Improves readability of indentations (e.g., in pre or code) by setting the tab size to 4 spaces.
tab-size: 4;
-moz-tab-size: 4;
⚙️ Normalization and 🧩 Usability
Ensures the html element fills the full height of the viewport, making it easier to build 100vh layouts using flex or grid. This is not a native behavior in all browsers.
min-height: 100%;
🧩 Usability
Forces the scrollbar to be visible even when there's no overflow, preventing layout "jumps" between pages with and without scrollbars. Very useful for visual stability.
overflow-y: scroll;
🧩 Usability
Improves typography rendering consistency between macOS (or WebKit) and other platforms, especially to avoid blurry text.
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
⚙️ Normalization and 🧩 Usability
Removes the gray/blue "flash" that appears when tapping links or interactive elements on Android/iOS WebKit. Improves the touch experience.
-webkit-tap-highlight-color: transparent;
🧩 Usability
Prevents iOS Safari from resizing text after rotation or zoom, while still respecting user zoom preferences. Unlike user-scalable=no, this method remains accessible.
text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
♿ Accessibility
This section initializes the foundational styles of the page through the body element, which is considered a sectioning root in HTML. It sets up the visual base: background, text color, typography, and ensures a full-page minimum height, useful for layouts.
body {
background: var(--bux-page-bg);
color: var(--bux-page-color);
font-size: var(--bux-typo-font-size);
line-height: var(--bux-typo-line-height);
min-height: 100%;
}
Applies the theme’s primary colors (light/dark) as soon as the page loads.
background: var(--bux-page-bg);
color: var(--bux-page-color);
🧩 Usability
Defines the base text size at the body level, which is then inherited by all child elements. Provides a consistent baseline across browsers using a CSS variable, instead of relying on inconsistent browser defaults.
font-size: var(--bux-typo-font-size);
⚙️ Normalization
A good line-height ensures better reading comfort, especially for people with cognitive or visual impairments.
line-height: var(--bux-typo-line-height);
⚙️ Normalization et ♿ Accessibility
Ensures layouts using 100vh, flex, grid, or a sticky footer work properly without the "blank page effect."
min-height: 100%;
🧩 Usability
his section focuses on HTML elements used to structure content in blocks: lists, blockquotes, code snippets, etc. It ensures these elements are visually consistent, accessible, and easy to style.
Prevents content like blockquotes (blockquote) or code blocks (pre) from overflowing their containers.
blockquote,
pre {
max-width: 100%;
}
🧩 Usability
Applies a consistent set of monospace fonts across all browsers, useful for pre blocks.
pre {
font-family: var(--bux-typo-font-family-mono);
}
⚙️ Normalization
Removes automatic bullets and numbering to allow for fully customized styling. This is a classic reset CSS technique!
ol,
ul {
list-style: none;
}
🔄 Reset
This section applies to inline HTML elements used to structure semantic text: links, abbreviations, emphasis, subscript, code blocks, etc. It improves their readability, accessibility, typographic consistency, and touch behavior.
a
)
a {
outline: 0;
text-decoration: none;
text-decoration-skip-ink: auto;
touch-action: manipulation;
}
Removes the focus outline (replaced elsewhere with :focus-visible
)
outline: 0;
🔄 Reset
Removes the default underline from links
text-decoration: none;
🔄 Reset
Improves the underline to prevent collisions with letters
text-decoration-skip-ink: auto;
🧩 Usability
Removes the 300ms delay on mobile (tap delay)
touch-action: manipulation;
🧩 Usability
abbr
, dfn
)
abbr[title],
dfn[title] {
cursor: help;
text-decoration: underline dotted;
}
Changes the cursor to indicate that information is available
cursor: help;
♿ Accessibility and 🧩 Usability
Adjusted underline to distinguish technical terms
text-decoration: underline dotted;
⚙️ Normalization
b
, strong
)Ensures that b
and strong
tags are displayed with a clearly visible weight, even if the font doesn’t handle it well natively.
Provides a consistent appearance of bold text across browsers.
b,
strong {
font-weight: bolder;
}
⚙️ Normalization
code
, kbd
, samp
)Applies a consistent monospace font for all code blocks, keyboard input, and terminal examples. Ensures a readable and uniform display of code, regardless of browser or OS.
code,
kbd,
samp {
font-family: var(--bux-typo-font-family-mono);
}
⚙️ Normalization
white-space
allows code
blocks to preserve line breaks while enabling automatic line wrapping if the text is too long.
Improves readability on mobile or small screens. max-width prevents overflow.
code {
max-width: 100%;
white-space: pre-wrap;
}
🧩 Usability
small
)Provides a consistent size for small
elements, which are often too small or inconsistent across browsers.
small {
font-size: 80%;
}
⚙️ Normalization
sub
, sup
)Fixes the vertical alignment and size of subscripts (sub
) and superscripts (sup
), which can cause line-height issues.
Ensures a clean and readable appearance across all browsers.
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub { bottom: -0.25em; }
sup { top: -0.5em; }
⚙️ Normalization and ♿ Accessibility
This section applies to HTML multimedia elements such as images (img), SVGs, videos, or clickable areas (area). It improves their responsiveness, touch usability, and graphical customization.
area
)Removes the 300ms delay on clickable areas (area
) in image maps for better mobile responsiveness.
area {
touch-action: manipulation;
}
🧩 Usability
audio
, canvas
, iframe
, img
, svg
, video
)Prevents unwanted vertical spacing beneath media elements when displayed inline (inline or inline-block). This spacing is caused by the default alignment to the text baseline. Setting vertical-align: middle; ensures consistent visual alignment by centering the elements vertically within the line, improving layout precision in mixed text/media contexts.
audio,
canvas,
iframe,
img,
svg,
video {
vertical-align: middle;
}
⚙️ Normalization and 🧩 Usability
Removes the highlight effect (often purple/blue) when selecting text or dragging over an image. Prevents unwanted visual effects, especially when accidentally dragging an image.
img::selection {
background-color: var(--bux-transparent);
}
🧩 Usability
img
, svg
, video
)Preserves the natural proportions of multimedia elements and prevents media from overflowing their container width. Together, these rules enable smooth and responsive scaling of images and videos, ensuring good adaptation on all types of screens.
img,
svg,
video {
height: auto;
max-width: 100%;
}
⚙️ Normalization and 🧩 Usability
fill
)Sets the fill color of SVGs from color, allowing SVG icons to be thematically styled automatically. SVGs automatically inherit the theme without needing specific inline styles.
svg {
fill: currentColor;
}
⚙️ Normalization
This section improves the handling of table
and td
elements by fixing inconsistencies across browsers and preventing overflow on small screens.
It ensures better readability, visual consistency, and mobile adaptability.
Fixes a style bug where borders do not match the text color (Chrome/Safari) and removes the automatic text indentation in some versions of WebKit. These two rules correct native style inconsistencies in certain browsers.
table {
border-color: inherit;
text-indent: 0;
}
⚙️ Normalization
Prevents tables or cells from overflowing their container, especially on small screens. Improves responsiveness and prevents unwanted horizontal scrollbars.
table,
td {
max-width: 100%;
}
🧩 Usability
This section aims to standardize the appearance of form fields, improve mobile usability, and fix native inconsistencies across browsers. It deals with elements such as button, input, select, textarea, progress, etc.
Removes the default style applied to buttons (background, border, etc.) and prevents accidental text selection during double-clicks.
button {
appearance: none;
border: none;
background: none;
user-select: none;
}
🔄 Reset and 🧩 Usability
Removes the touch delay of ~300ms on clickable elements (essential on mobile).
button,
input,
label,
select,
textarea {
touch-action: manipulation;
}
🧩 Usability
Ensures typographic consistency between form fields and the rest of the site (same font, same size).
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
font-size: 100%;
}
⚙️ Normalization
Disables automatic (uppercase
) transformations imposed by certain browsers (Edge, Firefox).
button,
select {
text-transform: none;
}
⚙️ Normalization
Displays a pointer cursor to reinforce the interactive nature of clickable elements.
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled),
label[for],
select {
cursor: pointer;
}
🧩 Usability
Forces buttons to render with their native appearance in Safari, while still maintaining CSS control.
button,
[type="button"],
[type="reset"],
[type="submit"] {
appearance: button;
-webkit-appearance: button;
}
⚙️ Normalization
Prevents input and textarea elements from overflowing their container width.
input,
textarea {
max-width: 100%;
}
🧩 Usability
Allows the user to select text in fields (which is sometimes blocked by default).
input,
select,
textarea {
user-select: text;
}
♿ Accessibility
type="search"
)Fixes their style in Safari and Chrome to prevent extra outlines or decorations.
[type="search"] {
appearance: textfield;
-webkit-appearance: textfield;
outline-offset: -2px;
}
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
⚙️ Normalization
progress
Vertically aligns progress bars with the surrounding text.
progress {
vertical-align: baseline;
}
⚙️ Normalization
Prevents horizontal resizing of textarea elements to avoid overflow and maintain mobile usability.
textarea {
resize: vertical;
}
🧩 Usability
Restores proper rendering of the file button (input[type="file"]) and inherits the correct font.
::-webkit-file-upload-button {
appearance: button;
-webkit-appearance: button;
font: inherit;
}
⚙️ Normalization
Fixes their alignment in Safari.
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
⚙️ Normalization
Prevents the addition of a border or padding when a field is selected via keyboard.
::-moz-focus-inner {
border-style: none;
padding: 0;
}
⚙️ Normalization
Removes the default red borders or shadows on invalid fields.
:-moz-ui-invalid {
box-shadow: none;
}
♿ Accessibility
This section ensures that certain native elements like summary
(within a details) or elements with role="button"
behave consistently, smoothly, and accessibly across all browsers and devices.
summary
By default, the visual behavior of summary
varies across browsers. By forcing it to display as a list item (list-item
), we improve its readability, accessibility, and compatibility with screen readers.
summary {
display: list-item;
}
⚙️ Normalization et ♿ Accessibility
Prevents text selection on elements that behave like buttons (such as asummary
or an element with role="button"
). This avoids unwanted visual effects during long presses or rapid clicks.
[role="button"],
details[open] summary,
summary {
user-select: none;
}
🧩 Usability
No support for legacy browsers. A progressive enhancement approach ensures graceful and functional degradation.
Contributions are welcome! Whether you'd like to report a bug, suggest an improvement, add a new feature, or fix a typo, feel free to get involved.
git checkout -bmy-suggestion)
.git commit -m 'Ajout: my-suggestion'
).git push origin my-suggestion
).MIT License, Free to use, modify, and distribute.