我有一个类用于article
and a section
HTML5 标签。
在家里:
<article class="exit">
<a href="exit.php">
<figure class="box">
<img src="assets/img/projects/exit-m.jpg" alt="">
<figcaption>…</figcaption>
</figure>
</a>
</article>
在项目页面上:
<section class="page project exit">
<div class="corner nw intro">
<figure class="box">
<img src="assets/img/projects/exit.jpg" alt="">
<figcaption>…</figcaption>
</figure>
</div>
…
每个元素与类exit have a figure
里面有 HTML5 元素。通过 Less,我可以使用这段代码来做我想做的事情。
article.exit{width:260px; height:200px; top:315px; left:505px;
figure{background-color:@exit-bg;}
.box:hover{.perspective-box(se, 10, @exit-shadow);}
}
section.exit{
.box:hover{.perspective-box(nw, 10, @exit-shadow);}
.intro figcaption:hover{background:@exit-hover;}
}
但我必须指定它是否是article
or a section
!我有很多这样的课程,这有点烦人……
有没有解决方案可以做这样的事情?这会很酷……
.exit{
&article{
width:260px; height:200px; top:315px; left:505px;
figure{background-color:@exit-bg;}
.box:hover{.perspective-box(se, 10, @exit-shadow);}
}
§ion{
.box:hover{.perspective-box(nw, 10, @exit-shadow);}
.intro figcaption:hover{background:@exit-hover;}
}
}