不工作后WordPress h1边框插入

时间:2014-08-26 18:50:41

标签: css

在wordpress中#content下的每个第一个孩子之后插入金色边框时遇到问题。

#content .spacer h1:first-child:after{

display:block;
content:'';
width:45px;
border-bottom:3px solid rgb(229,164,20);
margin:40px 0;
padding:5px 0;
}

是否有效

#content .spacer h1:first-child:after{

display:block;
content:'';
width:45px;
border-bottom:3px solid rgb(229,164,20);
margin:40px 0;
padding:5px 0;
}

1 个答案:

答案 0 :(得分:0)

我假设您的HTML标记,并且您希望在DIV#content.spacer中的每个H1元素之后添加带有黄金边框的空块。

使用h1:nth-​​child(1):在

之后是合适的

<强> HTML

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div id="content" class="spacer">
    <h1>First-child</h1>
    <h1>Children</h1>
    <h1>Children</h1>
    <h1>Children</h1>
  </div>
</body>
</html>

<强> CSS

#content.spacer h1:nth-child(1):after{
  display:block;
  content:'';
  width:45px;
  border-bottom:3px solid rgb(229,164,20);
  margin:40px 0;
  padding:5px 0;
}

这里的JSBIN示例:http://jsbin.com/wejefixajiro/1/edit