There is a universal format entry

<div.class> <span>Lorem</span> <p>Lorem</p> <ul><li></li></ul> </div> 

The task is to give everyone span, p, li, etc. the same styles. The styles are as follows:

  <style> .class p{} .class span{} .class ul{} .class li{} </style> 

The question is how to write it as short and capacious as possible?

  • span, p, li и т. д. {} - splash58
  • @ splash58, forgot .class before each of - Grundy
  • yes yes :) that's for sure - splash58
  • I just wanted to avoid a very long writing, * it was perfect while processing - Paralerodrom
  • @VitaliyGusarov, note that * applies to all nested elements, not paying attention to the level of nesting - Grundy

2 answers 2

Most likely, you need to use

 .class * { } 
  • I would say that it is better to use .class>* , something that will be inside <ul> - Mr_Epic

You need to work with the .class parameter.

Or like this. All specifications apply on all elements of Div .

 <div class="d"> <span>Lorem</span> <p>Lorem</p> <ul><li>Lorem</li></ul> </div> <style> .d span { font-size: 60pt; color: red; } .dp { font-size: 40pt; color: green; } .d li { font-size: 20pt; color: black; } </style> 

  • you're wrong, not all css properties are inherited - Grundy
  • The solution is not bad, but not all nesting work - Paralerodrom
  • Kirill is just what I have, but I have the same styles for all the elements, so I didn’t want to duplicate them, the scss doesn’t cause problems, and in pure css there is a jumble. - Paralerodrom