matching - Referencing a CSS class only within a specific element -
i trying find css syntax specific problem. searched couldn't find answer. here problem. html markup follow:
<div> <header> <div class="container"> <div class="row"> content want red </div> </div> </header> <div class="container"> <div class="row"> content want blue </div> </div> </header>
i display "my content want red" in red, , "my content want blue" in blue, , can use css that.
does knows trick make it? sub classes cant work here unfortunately.
thanks in advance,
there's lots of options. depends on circumstances. here's couple without modifying html:
using parent element
.row { color: blue } header .row { color: red }
using :nth-of-type
.column:nth-of-type(1) .row { color: red } .column:nth-of-type(2) .row { color: blue }
if you're willing add additional markup, add additional classes.
Comments
Post a Comment