html - Include style one CSS class to another -
is possible include styles of 1 css class another? mean sass @extends pretty similar thing, styles extended class, not required. see example:
<style>  .myclass1{    background:red;  }    .myclass2{    color:blue;    @extend .myclass1;  }  </style>    <div>    <p class="myclass2">hello class 2, text blue , background red</p>  </div>    <div>    <p class="myclass1">hello class 1, text should not blue , background red</p>  </div>posted example inspired article of css-tricks web, here confusing not working should. myclass2 should give myclass1 according article. however, giving strange output. heading in right direction? or article wrong?
update: question actual concept behind @extend of saas, , including other css class another, , difference?
css without pre-processors (sass, less etc.):
.myclass1{  	background:red;  }    .myclass2{  	color:blue;  }<div>  <p class="myclass1 myclass2">hello, of class 2 (my text blue) , of class 1 (my background red)</p>  </div>    <div>  <p class="myclass1">hello, of class 1 (my background red)</p>  </div>you can add multiple classes same element.
Comments
Post a Comment