ā¬†ļø ā¬‡ļø

Emulation>

As it is known, some browser does not support the ā€œ>ā€ rules in CSS, which is sometimes very necessary, for example, when creating a list of lists, when the first level of the list has no indentation, and the second and subsequent ones have it. Today I came up with a decision that I want to submit to your judgment:



 <style type="text/css"> .wrapper ul li {color: red; margin-left: 0;} .wrapper * ul li {color: green; margin-left: 20px;} </style> <div class="wrapper"> <ul> <li>red <ul> <li>green</li> <li>green</li> <li>green <ul> <li>also green</li> </ul> </li> </ul> </li> </ul> </div> 


The first rule in this case will be analogous to .wrapper > ul > li , as required.



It should be understood that this is not a full-fledged ">" emulation, because if you remove the .wrapper from the CSS rules, the result will be the same and this can be misleading.



Honestly, I’m not sure if I invented the wheel, because now I’m looking and I think that it all turned out to be too easy.

')

upd: mtonly prompted that "everything is already stolen to us": meyerweb.com/eric/thoughts/2005/05/31/universal-child-replacement

Source: https://habr.com/ru/post/70570/



All Articles