Is there an easy way to select all block level elements using CSS?
I want to put em 1.5 em margin between all the block level elements in the main content area of my site.
Now I have code like:
#wrapper .content p, #wrapper .content ul, #wrapper .content div, #wrapper .content ol, #wrapper .content blockquote, #wrapper .content table {margin-top: 1.5em;} #wrapper .content p:first-child, #wrapper .content ul:first-child, #wrapper .content div:first-child, #wrapper .content ol:first-child, #wrapper .content blockquote:first-child, #wrapper .content table:first-child {margin-top: 1.5em;}
Which is a royal pain in the rear to read or support ...
I would like to replace it with something like:
#wrapper .content *:block + *:block {margin-top: 1.5em;}
Is it possible?
I cannot use * + * because it will also catch inline elements, table cells, etc., and I do not want random fields applied in the middle of paragraphs. I also can not use #wrapper .content > * , because then it will not be nested div , etc.
css css-selectors
Jay irvine
source share