The :global operator is used in CSS Modules. Modular CSS uses a CSS Modules compiler to scope CSS styles within their respective modules (e.g., React component).

Here's an example from a React module (in the file ErrorMessaging.less for the ErrorMessaging.jsx React component):

:global(.ocssContainer) {
  .ui_column {
    padding-left: 0;
  }
}

This gets compiled into:

  .ErrorMessaging__alertContainer--1I-Cz .ocssContainer .ErrorMessaging__ui_column--3uMUS {
    padding-left: 0;
  }

But now I add a :global modifier onto .ui_column:

:global(.ocssContainer) {
  :global(.ui_column) {
    padding-left: 0;
  }
}

And this is what it compiles to:

  .ErrorMessaging__alertContainer--1I-Cz .ocssContainer .ui_column {
    padding-left: 0;
  }

Now .ui_column can apply to any child element with that style, including in a child React component, and not just .ui_column elements that are part of the ErrorMessaging React component.

Answer from JohnK on Stack Overflow
🌐
Every-layout
every-layout.dev › rudiments › global-and-local-styling
Global and local styling: Every Layout
We use a very on the nose naming convention, which emulates CSS declaration structure: property-name:value. This helps with recollection of utility class names, especially where the value echos the actual value, like .text-align:center. Sharing values between elements and utilities is a job for custom properties. Note that we’ve made the custom properties themselves globally available by attaching them to the :root (<html>) element:
🌐
Gatsby
gatsbyjs.com › documentation › how-to guides › styling › standard css
Standard Styling with Global CSS Files | Gatsby
In these cases, you can include a global stylesheet using gatsby-browser.js. NOTE: This approach does not work with CSS-in-JS. Use shared components to share styles in CSS-in-JS. First, open a new terminal window and run the following commands to create a new default Gatsby site and start the development server: Second, create a CSS file and define any styles you wish. An example...
Discussions

TUTORIAL – Add Global Styles in CSS
In WeWeb, you can add global styles in CSS. Here’s how: Upload your CSS stylesheet to WeWeb Go to your project Settings > File > Upload new file and uploading your CSS stylesheet Link your CSS stylesheet in the head of… More on community.weweb.io
🌐 community.weweb.io
0
1
January 27, 2022
css - What does :global (colon global) do? - Stack Overflow
The :global operator is used in CSS Modules. Modular CSS uses a CSS Modules compiler to scope CSS styles within their respective modules (e.g., React component). Here's an example from a React module (in the file ErrorMessaging.less for the ErrorMessaging.jsx React component): More on stackoverflow.com
🌐 stackoverflow.com
Do you have your own global.css file?
There are a ton of CSS philosophies, like BEM , Cube , utility classes , etc. Try out some approaches and stick with what feels good, also things might change when you work with a larger team. More on reddit.com
🌐 r/webdev
19
4
October 16, 2024
How & where to create a global CSS stylesheet
In some other forum posts, people have talked about a global CSS stylesheet, but haven’t specified how or where to create it. We would like to create CSS code to apply to the entire site (all pages). How do we do that? Do we create it in an external file and import it? More on forum.builder.io
🌐 forum.builder.io
0
0
May 17, 2023
🌐
CSS-Tricks
css-tricks.com › defining-global-styles-in-wordpress
Defining Global Styles | CSS-Tricks
March 1, 2023 - Earlier, we discussed how a global element, like Heading 2, can also be part of another block. We used the Query Loop block as an example, where Heading 2 is used for each post title.
🌐
PatternFly
patternfly.org › developer-resources › global-css-variables
PatternFly • Global CSS variables
Example: Note: global variables are scoped to :root · :root { /* Default & hovered link colors */ --pf-v5-global--link--Color: #06c; --pf-v5-global--link--Color--hover: #004080; } The full list of global CSS variables can be found below. Component variables are used to define custom properties at the component-level.
🌐
WeWeb Community
community.weweb.io › tutorials
TUTORIAL – Add Global Styles in CSS - Tutorials - WeWeb Community
January 27, 2022 - In WeWeb, you can add global styles in CSS. Here’s how: Upload your CSS stylesheet to WeWeb Go to your project Settings > File > Upload new file and uploading your CSS stylesheet Link your CSS stylesheet in the head of…
🌐
Reddit
reddit.com › r/webdev › do you have your own global.css file?
r/webdev on Reddit: Do you have your own global.css file?
October 16, 2024 -

As someone who's learning about Web Dev (with React), I just noticed how handy a global.css file is for keeping the same look across all of the pages and components.
I'd establish a palette of at least 5 matching colors to use. I'd set responsive font sizes for different devices. I could also set how buttons should look like and behave. And so on...

Question is, is this a common practice? Is that how you or your company keep the styles unified for every single project's frontend?

Example:

.global-title {
  font-size: 0.8rem;
  font-weight: 600;
}
/* Medium screens */
@media (min-width: 768px) {
  .global-title {
    font-size: 1rem; 
  }
}
/* Large screens  */
@media (min-width: 1024px) {
  .global-title {
    font-size: 1.2rem;  
  }
}
Find elsewhere
🌐
Pendo
support.pendo.io › hc › en-us › articles › 23124276217115-Edit-the-global-CSS-in-Visual-Design-Studio
Edit the global CSS in Visual Design Studio – Pendo Help Center
November 6, 2024 - Here's an example of the CSS classes you may wish to change: ... .pendo-resource-center-badge-notification-bubble { height: 13px !important; width: 13px !important; padding: 3px !important; font-size: 12px !important; } You can disable the ability ...
🌐
Next.js
nextjs.org › learn › pages-router › assets-metadata-css-global-styles
Pages Router: Global Styles | Next.js
CSS Modules are useful for component-level styles. But if you want some CSS to be loaded by every page, Next.js has support for that as well. To load global CSS to your application, create a file called pages/_app.js with the following content:
🌐
GitHub
gist.github.com › gndx › 1dac0b04c16686fca141c56d0221f883
global.css · GitHub
global.css · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters ·
🌐
meyerweb
meyerweb.com › eric › articles › webrev › 199805.html
Creating a Global Style Sheet
Plus if you ever decide to change the styles, you only edit general.css, and the entire server reflects the change. Now that's power. Of course, you may have some pages which require some changes to your general styles. For example, let's say that your help page-- you do have a help page, right?-- should have a navy sidebar instead of an olive sidebar.
🌐
Emotion
emotion.sh › docs › globals
Emotion – Global Styles
Sometimes you might want to insert global css like resets or font faces. You can use the Global component to do this. It accepts a styles prop which accepts the same values as the css prop except it inserts styles globally.
🌐
GeeksforGeeks
geeksforgeeks.org › css › foundation-css-global-styles
Foundation CSS Global Styles - GeeksforGeeks
July 23, 2025 - These Global Style Colors can be easily used to give interactive colors to Foundation CSS components such as links, callouts, or buttons. ... Example: The following code shows the font size of the text (paragraph tag <p>) displayed.
🌐
The Spicy Web
spicyweb.dev › css-nouveau › 1-vanilla-has-never-tasted-so-hot › 3-how-to-organize-your-(global)-stylesheets
How to Organize Your (Global) Stylesheets | The Spicy Web
August 24, 2025 - Because sure, you might only have 5 or 10 page templates early on in your project, and but eventually you’ll wake up one day and realize you have 50 and they’re all littered with custom CSS. D’oh! ... scoped style rules at the component level. For instance, we could express the above example by defining a true header component, where one variant of that header component would be to use the “fancy” font for its title. Then, in the markup for the Events Calendar, you could utilize that header variant right from your template markup, rather than relying on a custom body class and related “global” CSS.
🌐
Cwicly
docs.cwicly.com › global-styles › global-styles
Global Styles | Documentation
September 11, 2023 - The Global Styles option adds an interface to apply styling when in the Gutenberg editor.
🌐
W3Schools
w3schools.com › tags › att_global_style.asp
HTML Global style Attribute
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
🌐
Builder.io
forum.builder.io › general
How & where to create a global CSS stylesheet - General - Builder.io Forum
May 17, 2023 - In some other forum posts, people have talked about a global CSS stylesheet, but haven’t specified how or where to create it. We would like to create CSS code to apply to the entire site (all pages). How do we do that? …
🌐
Sarasoueidan
sarasoueidan.com › blog › style-settings-with-css-variables
Global and Component Style Settings with CSS Variables
June 1, 2020 - Over the last few months, I’ve ... my CSS differently… · Today, at the beginning of each project, I create a _settings.scss stylesheet. This stylesheet contains the global settings for the project. These settings are usually derived from the design style guide provided by the design team I’d be working with. An example of visual ...
🌐
Next.js
nextjs.org › learn-pages-router › basics › assets-metadata-css › global-styles
Global Styles - Assets, Metadata, and CSS
CSS Modules are useful for component-level styles. But if you want some CSS to be loaded by every page, Next.js has support for that as well. To load global CSS to your application, create a file called pages/_app.js with the following content:
🌐
CSS-Tricks
css-tricks.com › regarding-css-global-scope
Regarding CSS's Global Scope | CSS-Tricks
January 4, 2019 - The problem is when developers want to both scorn global scope but also take advantage of it, usually because of a misplaced desire for ‘reusability’. In my experience, reusability is highly overrated in CSS. I’m not saying that we should never strive for it, but we should be very cautious about it. For example, we should only extract a separate ‘reusable’ component from another component when we find ourselves actually reusing it somewhere else.