Blackbams Blog
development – digital arts – internet
Knowledge is free. No one may take possession of it.
9. April 2015
Recently I discovered some short solution for ignoring a single hidden element with the nth-child selector. If you struggle with the same problem the following might be useful:
This is the HTML:
a
b
c
d
e
The following CSS adds a margin right to every second visible element no matter which element has the cpw class.
.cpw {
display:none;
}
.video_prewrap {
margin-right:20px;
}
.video_prewrap:nth-child(2n) {
margin-right:0;
}
.cpw ~ .video_prewrap:nth-child(2n) {
margin-right:20px;
}
.cpw ~ .video_prewrap:nth-child(2n-1) {
margin-right:0;
}
No comments yet
Kommentare abonnieren (RSS) or URL Trackback
Leave a comment: