我想:第一种类型会影响我的情况下的第一种类型
<div class="Box">I am the first Box in div.center...</div>
如果我删除< div class =“top”> CSS工作并添加绿色顶部边框.
但我需要< div class =“top”>,如果< div class =“top”>,为什么它不起作用?在那儿?
<div class="main-wrap"> <div class="center"> <h3>Lorem Ipsum</h3> <div class="top">XXX XXX XXXX</div> <div class="Box">I am the first Box in div.center. Why no top border?</div> <div class="Box"></div> <div class="Box"></div> <div class="Box"></div> </div> </div> .Box { width:100%; height:30px; margin:10px 0; background-color:orange; } .main-wrap .center div.Box:first-of-type { border-top:4px solid green; } .Box { position:relative; border-bottom:4px solid green; }