Joe*_*ier 10 css css-selectors
我通过在段落上使用浅色边框作为边框顶部,并在其上使用黑色边框作为边框底部,在段落之间创建插入边框效果.
我正在尝试使用p:first-child删除第一段上的顶部边框,而p:last-child则删除底部边框上的边框.(他们有一类"介绍"fyi).
删除:last-child上的底部边框的样式工作正常,但由于某种原因,删除:first-child上的顶部边框的样式不是.
它必须是一个错字或一些愚蠢的东西,因为我无法弄清楚它为最后一个孩子而不是第一个孩子工作的原因.
markup:
<div id="intro">
<div class="wrap">
<h1 class="intro">Hi! I'm <a href="http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=Joel+Andrew+Glovier">Joel Andrew Glovier</a></h1>
<p class="intro">I'm a <a href="http://www.jagdesignideas.com/portfolio/web.html">web designer</a> and <a href="http://en.wikipedia.org/wiki/Front_and_back_ends">front-end developer</a>, currently working for <a href="http://cure.org">CURE International</a> full time. I also do some <a href="http://www.jagdesignideas.com">freelance work</a>, I <a href="http://twitter.com/jglovier">tweet a little</a>, <a href="http://www.jagdesignideas.com/blog/">blog</a> & can be found on <a href="http://jagdesignideas.com/contact.html">other social media</a>. I have <a href="http://dribbble.com/players/jag">lots of projects</a> going on at once - and I like it that way.</p>
<p class="intro">I'm a <a href="/good-news">follower of Jesus</a>, and a proud father and husband. I'm also a <a href="http://www.google.com/images?q=bboy&um=1&ie=UTF-8&source=univ&ei=dOpGTID9JoKKlwfV1vWfBA&sa=X&oi=image_result_group&ct=title&resnum=4&ved=0CDoQsAQwAw&biw=1920&bih=1102">bboy</a>, I <a href="http://jagboards.com/">skateboard</a>, and did I mention that I'm a die-hard <a href="http://www.steelers.com/">Pittsburgh Steelers</a> fan? Oh, and I've been to <a href="http://hmiafrica.org/">Kenya three times</a>.</p>
<p class="intro">Well it's nice to meet you! now that you know so much about me, <a href="http://twitter.com/home?status=@jglovier%20Hi%20Joel!" target="_blank">why don't you say hi</a>.</p>
</div><!--/.wrap-->
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
div#intro p:first-child {
border-top:none;
}
div#intro p:last-child {
border-bottom:none;
}
Run Code Online (Sandbox Code Playgroud)
Gum*_*mbo 28
p:first-child不起作用,因为该h1元素是其相应父元素的第一个子元素; 所述p元件是所述第二,第三和第四子元素.p:first-of-type而是仅使用选择该类型的第一个元素p.