I've got the following HTML structure which I'm trying to style using CSS selectors only:
<footer>
<div class="row">
<div class="col-md-3"></div>
<nav class="col-md-9"></nav>
</div>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-9"></div>
</div>
</footer>
Imagine all the columns are stacked in a small viewport. I want all columns except for the very last one to apply a margin-bottom to space the columns.
I've tried some different approaches, but to no avail:
footer [class^="col-"]:not(:last-child) {
margin-bottom: 3rem;
}
footer [class^="col-"]:not(:last-of-type) {
margin-bottom: 3rem;
}
First, why do these fail? Second, what's the right approach here?
:notcannot handle complex selectors. stackoverflow.com/a/26997609/2813224