HTML CSS examples for CSS Selector:element parent child
CSS: Select element only if a later sibling exists
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> main {<!--from w ww . j a va 2s.com--> padding:6%; border:4px dashed Chartreuse; } main>aside { float:right; width:21%; background:silver; } main>section { width:100%; background:green; } main>aside + section { width:71%; margin-right:31%; background:blue; } </style> </head> <body> <main> <aside> Lorem ipsum d </aside> <section> Lorem ipsum dol <br>Lorem <br>Lorem </section> </main> <br> <br> <br> <main> <section> Lorem ipsum dolor si </section> </main> </body> </html>