How to make b have the attributes of a?
Just do it directly.a,.b{……}
Just do it.a,.b{……}
Didn’t .a, .b also change a? Isn't it okay to just inherit without overwriting?
background-color is the background color; color is the font color
background-color is the background color; color is the font color
This is not the point, I am just giving an example, if If a color is added to the element of a, how to change the font color in b and inherit the background color of a?
You can write three styles, .a {color:red;//a unique style} .b {color:blue;//bunique style} .a,.b {background-color :red;//a b public style}
Quote from 1st Floor’s reply:
Just .a,.b{……}
.a,. Didn’t b also change a? Isn't it okay to just inherit without overwriting?
I won’t change it, you do this
<style>.a,.b{ background-color:red;}.b{ color:red;}</style>
Quote from 2nd Floor’s reply:
Quote from the 1st floor’s reply:
Just .a,.b{……}
.a, .b didn’t even change a? Isn't it okay to just inherit without overwriting?
I won’t change it, you are like this
HTML code
In this case, b has background-color and colo at the same time...
Me I hope to use b to inherit all the attributes of a, and modify or supplement other attributes. The premise is that a is not changed, and b does not exist when a is declared, so this cannot be solved.
You can write three styles, .a {color:red;//a unique style} .b {color:blue;//bunique style} .a,.b {background-color :red;//a b public style}
I want a to be the default style and b to be a selected style, so a cannot be declared together with b, and there cannot be a common style.
There seems to be no solution? If you can’t help it, just post it and share the hard work with everyone