CSS3nth类型限于类

有没有办法限制CSS 3?nth-of-type去上课?我有一个动态数字section具有指定其布局需求的不同类的元素。我想每3小时拿一次.module,但似乎nth-of-type查找类元素类型,然后计算该类型。相反,我只想把它限制在.moduleS.

谢谢!

JSFiddle将展示:http://jsfiddle.net/danielredwood/e2BAq/1/

HTML:

<section class="featured video">
    <h1>VIDEO</h1></section><section class="featured module">
    <h1>NOT A VIDEO</h1></section><section class="featured module">
    <h1>NOT A VIDEO</h1></section><section class="featured module">
    <h1>NOT A VIDEO (3)</h1></section><section class="featured module">
    <h1>NOT A VIDEO</h1></section><section class="featured module">
    <h1>NOT A VIDEO</h1></section><section class="featured module">
    <h1>NOT A VIDEO (6)</h1></section>

css:

.featured {
  width:31%;
  margin:0 0 20px 0;
  padding:0 3.5% 2em 0;
  float:left;
  background:#ccc;}
  .featured.module:nth-of-type(3n+3) {
    padding-right:0;
    background:red;
  }
  .featured.video {
    width:auto;
    padding:0 0 2em 0;
    float:none;
  }

CSS3nth类型限于类

慕慕森
浏览 433回答 3
3回答

ABOUTYOU

不幸的是,没有办法(至少我不知道)选择nth-of-type一堂课,因为nth-of-class根本不存在。您可能需要每隔三分之一就添加一个新类。.module手动。
打开App,查看更多内容
随时随地看视频慕课网APP