Hide unregistered custom elements
my-widget:not(:defined) {
display: none;
}
The :defined pseudo-class matches elements that are defined—including built-in HTML elements and custom elements after customElements.define. Use :not(:defined) to hide upgrades-in-progress.
my-card:not(:defined) {
display: none;
}my-widget:not(:defined) {
display: none;
}:defined is a CSS selector.
Supported in modern browsers.
Bottom line: Safe for modern sites. Keep readable defaults without the selector.
Apply styles with properties.
CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
2 people found this page helpful