小编Bst*_*der的帖子

CSS - nth-child()示例

给出下面的示例,每行需要有三个文本列,即三个句子,其中中间的列也需要有一个background-color.是否可以使用nth-child() 选择器执行此操作?

p {
  display: inline-block;
  width: 30%;
}

p:nth-child(2n+0) {
  background: red;
}
Run Code Online (Sandbox Code Playgroud)
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
<p>The fourth paragraph.</p>
<p>The fifth paragraph.</p>
<p>The sixth paragraph.</p>
<p>The seventh paragraph.</p>
<p>The eight paragraph.</p>
<p>The ninth paragraph.</p>
Run Code Online (Sandbox Code Playgroud)

html css css-selectors css3

2
推荐指数
1
解决办法
274
查看次数

jQuery - 当我们点击另一个div时,从div中删除类

jQuery(document).ready(function() { 
    if(jQuery(window).width() < 768){
        jQuery('.nb-team-grid').on('click', function(e){
            jQuery(this).toggleClass('test');
        });
    }
})
Run Code Online (Sandbox Code Playgroud)

嘿家伙,我需要做一个互动.当我们点击一​​个div时,一个类需要添加,当我们再次点击时,该类应该删除它的自我.我做到了,你可以看到上面的代码.还有一件事我需要的是,我根据设计重复了很多次div.因此,如果我们单击任何div,则应该从我们之前单击的div中自动删除该类.请查看此链接以获得更多说明.谢谢 :)

http://dev.netbramha.in/projects/test-coder/test.html 点击此链接中显示的每个网格

html javascript jquery

1
推荐指数
1
解决办法
100
查看次数

标签 统计

html ×2

css ×1

css-selectors ×1

css3 ×1

javascript ×1

jquery ×1