Can someone please explain the below CSS code:
html:not([dir="rtl"]){
//some CSS property
}
html:not([dir="rtl"])
Let's break it down!
html
Selects all html elements (there's most likely only one)...
:not( ... )
... that do not...
[dir="rtl"]
... have the attribute dir set to "rtl".
So, to sum it up, it selects all html elements that do not have dir set to "rtl". Example:
<html> <!-- Would match! -->
<html lang="en"> <!-- Would match! -->
<html dir> <!-- Would match! -->
<html dir="ltr"> <!-- Would match! -->
<html dir="rtl"> <!-- Would NOT match! -->
*:not([dir="rtl"]) it would match any tag that had dir="rtl" (because * is the universal selector)dir="rtl" ??dir="rtl"It will select all html tags that don't have the attribute dir with value rtl.
Select html tag: html
Select the inverse: :not()
Select an attribute with specific value: [attribute="value"]