Within my CSS stylesheet, I have defined a class called myclass
.myclass {
background-color: 'green';
}
This class is dynamically added to elements on my webpage. However, if there are more specific selectors like input[type='text']
, their background-color
property takes precedence. To ensure that my myclass
style always applies, I need to write a more specific selector that will override any other styles on the element. One approach could be:
html body .myclass {
background-color: 'green';
}
Is there a better way to achieve this?