Hello I would like to use in my css simple inheritance from the browsers default values:
.myfromh1{
font-weight: bold;
}
Can I tell css that .myfromh1 class is owning all properties of the h1 default class?
thanks Arman.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not quite clear from your question what you want to achieve. CSS uses a hierarchy of overwriting rules.
Inline styles have precedence over
<style>block codeAll styles have precedence over styles that are defined earlier in the code
Styles with high specificity have precedence over less specific styles
Some browsers honor the
!importantkeywordTherefore, to answer your question, if your element is a
H1element, then it will automatically have all the properties of ah1selector, and only those that are overridden by the#myfromh1selector will be changed.If, however, you’re looking for true inheritance between selectors – if
#myfromh1is not a H1 element, but you want it to be styled like one, then the answer is that that cannot be achieved in CSS.