CSS Modules let you write familiar CSS while keeping class and animation names local to a stylesheet by default. A build tool compiles the stylesheet and gives JavaScript an object that maps your authored names to generated class names. This avoids many accidental name collisions, but it does not make every selector or style in an application automatically private.
What CSS Modules do
A CSS Module is a CSS file whose class and animation names are locally scoped by default. The CSS Modules project describes the compilation model as CSS being transformed through ICSS (Interoperable CSS) into regular CSS plus mapping data. When JavaScript imports the module, it receives an object that connects the local names you wrote to generated names used in the output. The browser does not natively interpret CSS Modules; your build pipeline must process them. See the CSS Modules project documentation and its setup guide.
From authored name to generated class
Suppose Button.module.css contains .button, and JavaScript imports it as styles. In the component, styles.button is the generated class string corresponding to the authored local name button. You use that returned value on the element rather than assuming that the authored name itself is the final class name:
import styles from './Button.module.css';
const button = document.createElement('button');
button.className = styles.button;
The exact generated string depends on the toolchain configuration. If two modules both define a local class named .button, each module can map that name separately, so the authored names do not inherently collide in the output. The local scope guide explains this behavior.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
How to enable CSS Modules in your build
CSS Modules are a build-tool feature, not a browser switch. Naming conventions and configuration differ, so follow the documentation for the tool and version actually installed in your project. The CSS Modules project setup guide also lists integrations including Bun, Lightning CSS, Parcel, PostCSS, Rspack, and frameworks; that integration list does not mean every implementation has identical options or behavior.
Vite
Vite treats files ending in .module.css as CSS Modules and returns the mapping object when such a file is imported. Its documentation also describes the css.modules configuration and preprocessor naming convention: put .module before the extension, as in Button.module.scss. For Sass, Vite’s shared options recommend sass-embedded for performance. Check the documentation matching your installed Vite version for exact options and setup details: Vite features and Vite shared options.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
webpack
webpack supports CSS Modules through css-loader. Its configuration governs how styles are processed in the loader chain, including local and global scope modes, generated scoped identifiers, and exported locals. Enable and configure it in the context of your existing webpack and loader versions rather than copying a single option in isolation. Consult the css-loader documentation for the relevant configuration.
What “local” scope covers—and what it does not
Local-by-default describes class and animation names in a CSS Module; it is not a guarantee that all CSS in an application is isolated. CSS Modules support explicit scope controls, including :global and :local. These are useful when a module must target global styles or markup whose class names come from outside the module. Their syntax is documented in the composition and scope guide.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
In practical terms, treat local names as the default boundary, and use an explicit global selector only when the integration requires one. Global rules elsewhere in the application remain global according to their own stylesheet and build setup.
How composition works
Composition lets one local class include the class name or names of another class. The exported value for the composing class can therefore contain multiple generated names. This is useful for reusable, single-purpose styles, but it does not merge CSS declarations into one rule or guarantee a particular cascade order across files.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Composition rules and caveats
- Write
composesbefore other declarations in the rule. - Only local-scoped selectors consisting of a single class selector are eligible for extension.
- Cross-file composition is supported, but the application order of multiple classes composed from different files is undefined.
- Avoid conflicting values for the same property across composed files, and avoid circular dependencies.
The project recommends building single-purpose classes with hierarchical dependencies. Its composition guide covers the syntax, scope controls, and limitations.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choosing an implementation path
Choose based on the build system already used by your project, then verify its module detection, configuration options, import convention, and preprocessor support in that implementation’s documentation. Vite documents filename-based detection for .module.css; webpack handles CSS Modules through css-loader. Those are different setup paths, not evidence that one is faster, more widely adopted, or preferable in every project.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
CSS Modules and the browser’s native @scope rule should not be treated as interchangeable based on these tool documents: they describe CSS Modules compilation and mapping, not a direct feature comparison with @scope. Evaluate each against the requirements and capabilities of your own browser and build setup.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

