Other answers give you the explanation you need; I will use a practical use case to feed any curiosity.
A common real-time use case for multiple class selectors separated by descendant compilers is when a site has a different body class for specific pages or specific devices.
For example, consider this markup for a simple website. Besides the header and footer, it also has a content column and two sidebars:
<body> <div id="wrap"> <div id="header"> <h1>My Site</h1> </div> <div id="content"> </div> <div id="side1" class="sidebar"></div> <div id="side2" class="sidebar"></div> <div id="footer"> <p>Copyright LOLOLOL</p> </div> </div> </body> </html>
The default setting may be to place #content between .sidebar s using some floating blende that I will not connect to.
On a mobile device, in addition to changing the entire size for a small resolution, perhaps the designer wants to do away with the side panels in order to bring back some sort of horizontal screen space. In addition to media processes, it is much easier to use server-side code to detect mobile browsers and the body tag with the corresponding class (for example, ASP.NET C # example):
<% if (((HttpCapabilitiesBase) Request.Browser).IsMobileDevice) { %> <body class="mobi"> <% } else { %> <body> <% } %>
Where your example comes in handy. The designer simply uses the following rule to hide the sidebars from mobile devices:
.mobi .sidebar { display: none; }
Of course, the same browser detection code could be used to hide the general layout of the sidebar, the size of the shave page and all this jazz, but again this is another way to get closer to this. I just give a quick, practical example of how several CSS selectors in a hierarchy can be used in CSS.
BoltClock Dec 05 2018-10-12T00: 00Z
source share