【发布时间】:2011-11-21 02:59:40
【问题描述】:
我做错了吗?
css/sass:
#section
article
border-top: 1px solid black
&:first-child
border: none !important
html/haml:
#section
%h2 title
%article
stuff here. There is still a top border here despite first-child style.
%article
stuff here.
%article
stuff here.
这样不行,第一个<article>还有边框。我必须再上一堂课,并在第一篇文章中做类似article.noborder 的事情,这样才能没有边界。任何帮助将不胜感激......css讨厌我。
【问题讨论】:
-
你做错的事情是误解
:first-child。article:first-child并不意味着“匹配第一个article元素”,它的意思是“匹配第一个子元素 if 这是一个article元素” - 在这种情况下,第一个子元素是一个 @987654329 @.
标签: html css sass pseudo-class