css virtual class : partial spacing

Asked 2 years ago, Updated 2 years ago, 63 views

Some text. Some other text. One more text

1) p:not(.classy) { color: red; } body :not(p) { color: green; }

2) p:not(.classy) { color: red; } body:not(p) { color: green; }

Next to the body: Is there a reason why the above two results are different due to the difference in spacing? Number 1 is "some other text" and number 2 is green.

css pseudo-class

2022-09-21 20:35

1 Answers

body :not(p) {
  color: green;
}
/* Change the color of the non-p tag elements in the body tag to green. */
/* Since there is no element other than a p tag in the body tag, the body tag is applied as a basic color. */


body:not(p) {
  color: green;
}
/* Change the color of the body tag to green instead of p tag. */
/* Body tag can't be a ptag. Body tag applied as green. */

I think it'd be good to interpret it like this. If you want to understand more about the selectors, use the link below to help you. https://opentutorials.org/module/484/4150


2022-09-21 20:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.