Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 删除空paragrapf并更改h3元素css_Html_Css - Fatal编程技术网

Html 删除空paragrapf并更改h3元素css

Html 删除空paragrapf并更改h3元素css,html,css,Html,Css,我在wordpress网页上有一些博客。这些博客可以从仪表板添加。问题是,新博客产生了一些html元素,这些元素扰乱了设计 这是生成的hml: <div class="loop-entry-excerpt entry clr" style="position: absolute;"> <p></p> <h3>Creating a Culture of Innovation</h3> Last week, I

我在
wordpress
网页上有一些博客。这些博客可以从仪表板添加。问题是,新博客产生了一些
html
元素,这些元素扰乱了设计

这是生成的hml:

<div class="loop-entry-excerpt entry clr" style="position: absolute;">
    <p></p>
    <h3>Creating a Culture of Innovation</h3>
      Last week, I had the opportunity...
   <p></p>
   <div class="button_Read_More text-right">
       <a href="http://staging.princetonpartners.com/tips-from-googleplex/"><span id="readMore_button" class="blog_readmore">Read more</span></a>
        </div>
     </div>
你能告诉我如何通过css解决这个问题吗?我可以用纯css做这个吗?谢谢

我可以用纯css做这个吗

我对此表示怀疑,但下面jQuery可能会有所帮助

jQuery(function($){
  $(document).ready(function(){
  $('h3').each(function(){
    $(this).replaceWith('<p>'+$(this).text()+'<p>');
  });
  $('p').each(function(){
    if(!$(this).text().length){
    $(this).remove();
  }
  });

});
});
jQuery(函数($){
$(文档).ready(函数(){
$('h3')。每个(函数(){
$(this).replace为(''+$(this).text()+'');
});
$('p')。每个(函数(){
if(!$(this.text().length){
$(this.remove();
}
});
});
});

查看小提琴。

您可以使用
p:empty
删除空
p
元素。但是我认为你不能用CSS来代替h3的
p
jQuery(function($){
  $(document).ready(function(){
  $('h3').each(function(){
    $(this).replaceWith('<p>'+$(this).text()+'<p>');
  });
  $('p').each(function(){
    if(!$(this).text().length){
    $(this).remove();
  }
  });

});
});