从内容索引H4和H5标题为父级和子级

时间:2016-10-22 14:25:44

标签: php jquery

以下是我的内容的样子:

$content ='<h4>Pros of personal loans</h4>
<h5>Consolidation for your</h5>
<p>credit cards and other debts. A personal loan can be used</p>
<h5>Can you afford it?</h5>
<p>Improved credit score. You may improve your credit score by moving</p>
<h4>Cons of personal loans</h4>
<p>Higher interest rates than secured loans and (some) credit cards.</p>
<p>Extended application process.</p>
<h4>Is a personal loan right for you?</h4>
<p>Personal loans work best as part of a</p>
<h4>test</h4>
<p>Personal loans work best as part of a</p> 
<h5>test1</h5>
<p>Personal loans work best as part of a</p>';

这就是我想要的方式:

<h4>Pros of personal loans</h4>
--<h5>Consolidation for your</h5>
--<h5>Can you afford it?</h5>
<h4>Cons of personal loans</h4>
<h4>Is a personal loan right for you?</h4>    
<h4>test</h4>   
--<h5>test1</h5>

以下是我想要做的设计:http://screencast.com/t/lN3HtBYjEWUA

任何帮助将不胜感激。提前致谢

1 个答案:

答案 0 :(得分:0)

您需要在h4中移动h5标签,如下所示:

$content ='<h4>Pros of personal loans
              <h5>Consolidation for your</h5>
              <p>credit cards and other debts. A personal loan can be used</p>
              <h5>Can you afford it?</h5>
           </h4>.................'
相关问题