CSS has detected an invalid value for the property across all components. Please

Need help reverting the style of a child element back to default and receiving an error message saying "Invalid Property Value".

HTML:

<div class="dropdown locale-selector">
   <button class="btn btn-secondary " type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
   Dropdown button
   </button>
   <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
      <a class="dropdown-item" rel="alternate" hreflang="en" href="">
      English
      </a>
      <a class="dropdown-item" rel="alternate" hreflang="es" href="">
      español
      </a>
   </div>
</div>

CSS:

.locale-selector a {
    all: revert;
}

Error in CSS:

Invalid Property Value all: revert

Answer №1

As of the fourth quarter of 2020, the revert CSS property is now officially supported in all latest versions of the four major desktop browsers, which include Firefoxv67+, Safariv9.1+, Chromev84+, and Edgev84+.

However, mobile support for this property varies with iOS SafariiOS 9.3+, Android Firefoxv79, and Android Chromev85 being among those that currently support it.

For real-time statistics on browser support for the revert CanIUse.com page can be consulted.

Answer №2

Initially, it's important to note that the CSS property "all:revert" will not function properly on Internet Explorer. This may be the cause of any issues you are encountering. The purpose of using "all:revert" is as follows:

  1. It clears out all directly assigned CSS property values on your element.
  2. Any properties inherited from parent elements (typically text-based attributes like font) are now inherited by the element through normal cascading.
  3. Non-inheritable properties (such as display or border) are removed from the element and replaced with values specified in the browser's user agent style sheet. Other styles for these properties on the element will be disregarded. Essentially, this resets the element to its default browser style.
  4. Keep in mind that if there are more specific styles overriding the "revert" declaration on the element, those styles will take precedence. Like any other CSS property, "all:revert" can be overridden by more specific styling.

For example, if a custom "font" value (inheritable) was applied to a div, it would be removed and the font setting from the parent hierarchy above the div would be used instead. On the other hand, if a custom "border" value (non-inheritable) was set, it would be replaced by the default browser value for "border" on a "div" element in the browser's style sheet. Typically, this default value is "none" for "border on "div".

Additionally, "all:unset" operates similarly but defaults to "initial" for non-inheritable properties. This can result in unexpected behavior as it applies the universal default value for the property, regardless of the element using it.

Therefore, changes made with "all:revert" to non-inheritable properties will not impact children's styles unless explicitly set to inherit from their children. In contrast, inheritable settings like fonts, color, and line-height will begin inheriting styles from higher up the parent hierarchy. It's worth mentioning that in CSS, the distance of a parent does not affect specificity, but it could influence the changes you observe.

If you notice odd text appearances, examine the newly inherited styles from parents above the code snippet. Using "all:revert" broadly throughout markup may lead to confusion. It's recommended to apply revert only to specific elements to reset them back to browser defaults for non-inheritable values, or to reset the entire page to browser defaults for both inheritable and non-inheritable properties.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Disabling a button until all textfield fields are completed: A Step-by-Step Guide

My modal contains a table with the following code structure. <div> <Table> <tbody> {props.data.map((p) => <> <tr> <th> STC </th> ...

Adding a PHP file into an HTML page using JavaScript include

Recently, I was assigned to collaborate with a third-party vendor who displays movie times on their platform. We were given the opportunity to co-brand our website on their platform by creating a wrapper for our site. This wrapper would allow the movie tim ...

Show data in a popup using jQuery DataTables and loading content asynchronously via Ajax

I am attempting to display a list in a popup based on an Ajax request. Prior to the Ajax call, the list is contained within the popup. However, after the Ajax request, the list remains on the page instead of inside the popup, and the old list still appears ...

Looking for assistance with fundamental HTML concepts

I'm struggling to make the navigation bar stretch to full height. As a beginner in HTML and CSS, I have limited knowledge about it. I have tried numerous solutions found on the internet but nothing seems to work. The styling and HTML code are provide ...

Place the block at the bottom without using absolute positioning

In the design, there is a block that should be positioned absolutely on desktop screens. However, for mobile screens, it needs to adapt so that elements do not overlap. .wrapper { position: relative; border: 2px solid black; border-radius: 1 ...

Prevent background music from being manipulated

I've implemented an audio HTML element with background music for a game: <audio class="music" src="..." loop></audio> However, I have encountered an issue where upon loading the page, I am able to control the music usi ...

Implementing a Bootstrap bottom popover when an image is clicked using JavaScript

Does anyone know how to display a Bootstrap bottom pophover when an image button is clicked using JavaScript? Appreciate any help! ...

What could be preventing me from typing in the input field that's linked to an Angular model in Firefox browser?

Having trouble entering text in input on Firefox, even though it works fine on Chrome. No CSS issues or jQuery used. Here is my HTML code: <div class="todo_content" style="width:66%"> <input class="todo_add_input" autofocus="autofocus" ...

Attempting to align three divs to the left, center, and right by utilizing Bootstrap CSS

I've been attempting to align three divs horizontally by floating them to the left, center, and right. Here is my code so far: HTML //to be centered div <div style="float:center"> <form> </form> <form> </ ...

Error with jquery.mobile-1.4.5.min.css in Android webview following recent Marshmallow update has caused compatibility issue

Creating a web page using JQuery was successful and the page loaded correctly on an Android device (Nexus 5) through WebView. However, after updating the Nexus 5 to Android Marshmallow, the web page could no longer be viewed properly on the WebView. Inste ...

Looking to enhance my JavaScript skills - Codepen samples welcome!

I have incorporated this code pen in my website to create a menu button for mobile view: http://codepen.io/anon/pen/LNNaYp Unfortunately, the button sometimes breaks when clicked repeatedly, causing the 'X' state to appear even when the menu is ...

Struggling with IE7 compatibility issues regarding tables inside a div? Seeking a reliable resource to gain insights and strategies for effectively resolving IE7 problems

I am currently in the process of revamping this website: but I am facing a challenge with repeating a gradient within a div (cnews). The problem arises when the gradient is repeated on IE7, as it distorts the color. It appears as though the blue in the im ...

Step-by-step guide: Crafting an UP Arrow solely with HTML and CSS

What is the method to utilize solely HTML and CSS for creating a triangle? I am in need of constructing a thick triangle, but want to achieve this using only CSS So far, I have experimented with the following code: .arrow-up { width: 0; height: 0 ...

The Silent Disregard for CSS Files in React Rendered Pages

I'm currently working on a React application that I created using create-react-app. In my index.html file, I have linked it to my CSS file like this: <link rel="stylesheet" href="../src/site.css"></link> The content of the site.css file ...

Elements that allow for asynchronous data submission without requiring a traditional submit button

Hey there, I could really use some help with this puzzle I'm trying to solve. Here's the situation: <ul> <li>Number: <span id="Number">123</span></li> </ul> I want to set up a connection between t ...

Aligning a child div within a parent div using HTML/CSS where the child div takes up 30% of the parent div and

Can anyone help me figure out why these two INPUT elements aren't aligning next to each other? I appreciate any assistance you can offer! <STYLE> html, body { width: 100%; height: 100%; margin: 0px; padding: 0px; } </STYLE& ...

What is the process for populating a checkbox with data from a configuration file using JavaScript?

I have a requirement where I need to populate a list of checkboxes with data from a configuration file. To elaborate, if my checkboxes are meant to select sports, within my JSON configuration file I have an array like this: sports: ["Tennis", "Rugby", "S ...

Creating a stylish flyout search box using CSS

I am looking to create a search box that pops up when a button is clicked and disappears when clicked outside. My approach involves using CSS to achieve this functionality. Here is the HTML structure I am working with: <div tabindex="0" class="search" ...

The Bootstrap grid feature is malfunctioning on both Codeply and devtools. The dimensions of the <div class="col-lg-3 col-md-4 col-sm-6"> element remain constant despite attempts to adjust them

After experimenting with the viewport meta tag and enclosing it in a div class="container", I found that the issue persists on Codeply and Chrome DevTools. However, when I adjust my browser size, the problem seems to disappear. I also tried using various v ...