I am having problems with an advanced negation pseudo-class selector in a :not(s)
selector (!!in Google Chrome!!).
I have this HTML markup:
<div class="body">
<div class="container">
<div class="element-1"></div>
<div class="element-2"></div>
<div class="element-1 element-offset-2"></div>
<div class="element-3"></div>
</div>
</div>
And I use the following CSS to have a margin-left
on every element-
element (except the first one):
div[class*="element-"] + div[class*="element-"] {
margin-left: 1%;
}
See https://jsfiddle.net/em6hefqj/2/ for a working example.
But here is the problem, I don't want the element with the class
element-offset-n
to have the margin-left
. I use the following CSS for that:
div[class*="element-"] + div[class*="element-"]:not([class*="element-offset-"]) {
margin-left: 1%;
}
See https://jsfiddle.net/em6hefqj/ for a working example.
As you can see above, I use
[class*="element-offset-"]
, but I have to use div[class*="element-offset-"]
. I cannot use the advanced selector without the element prefix because it will cause conflicts between different elements on the same page (div
, p
and a few more). This works (what I have tested) in Safari and Firefox, but it does not work in Google Chrome See https://jsfiddle.net/em6hefqj/1/ for a (in Chrome) not working example.
Here are some images for reference:
Chrome (works without div
in front of the selector):
Safari (works with div
in front of the selector):
Chrome (does not work with div
in front of the selector):
I hope you can help me with this, I am open to suggestions. This might be a bug if so I'll report it to the Chrome developer team.