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.
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.
It's not quite clear from your question what you want to achieve. CSS uses a hierarchy of overwriting rules.
<style>
block code<style type="text/css">
#test { color: red; }
</style>
<span id="test" style="color: blue;">This text will be blue</span>
<style type="text/css">
#test { color: red; }
#test { color: blue; }
</style>
<span id="test">This text will be blue</span>
<style type="text/css">
#test { color: blue; }
.test { color: red; }
</style>
<span id="test" class="test">This text will be blue</span>
!important
keyword<style type="text/css">
span { color: blue !important; }
#test { color: red; }
<span id="test">This text should be blue</span>
Therefore, to answer your question, if your element is a H1
element, then it will automatically have all the properties of a h1
selector, and only those that are overridden by the #myfromh1
selector will be changed.
If, however, you're looking for true inheritance between selectors - if #myfromh1
is not a H1 element, but you want it to be styled like one, then the answer is that that cannot be achieved in CSS.