<div class="big_box">haha</div>
<div class="small_box">haha</div>
This (type 1) seems workable :-
.big_box, .small_box { border:1px solid #ccc; /* lengthy attributes*/}
.big_box { width:150px; height:150px; }
.small_box { height:140px; width:140px; }
This (type 2) also works :-
.big_box { border:1px solid #ccc; width:150px; height:150px; /* same lengthy attributes*/}
.small_box { border:1px solid #ccc; width:150px; height:150px; /* same lengthy attributes* }
Of course, type 2 is lengthy and repeating for most of the common attributes (with same value),
is there any issue for using type 1 ?
(or simply this is allowed ?)
P.S type 3 works too (but I find is hard to manage) … if
<div class="box big">haha</div>
And
.box { border:1px solid #ccc; /* lengthy attributes*/}
.big { width:150px; height:150px;}
type 1 is actually very common when declaring multiple classes with some share the same attributes and some have their owned unique attributes. type 2 is a bit dirty to maintain while type 3 is similar to type 1.
it is all works, just a matter of coding style and ease of maintenance