Descendent Selectors in CSS



Suppose you want to apply a style rule to a particular element only when it lies inside a particular element. As given in the following example, style rule will apply to <em> element only when it lies inside <ul> tag.

ul em {
   color: #FFFF00;
}

Suppose now for <ol> element and style rule applied to <strong>:

ol strong {
   color: #808000;
}
Samual Sam
Samual Sam

Learning faster. Every day.


Advertisements