I would like to know if I can overwrite child-class styles with parent-class styles. This is my code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.red {
color: red;
}
.blue {
color: blue;
}
.parent {
border: 2px solid chocolate;
/*this does not work*/
color: green;
color: green !important;
}
/*this also does not work*/
body .parent {
color: green;
}
</style>
</head>
<body>
<button class="parent">
<span class="red">H</span>
<span class="blue">i</span>
</button>
</body>
</html>
I have found a similar question here. But that is not what I have in my mind.
[https://stackoverflow.com/questions/73121465/override-child-class-css-with-parent-class-css][1]