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();
}
});
});
});