【www.bbyears.com--网页配色】
之前用过img的margin负值,只能定义某些标签里面的p里面的img,如table p img{margin-bottom:-32px;},但对于文字中的图片确是无法控制的。所以下面是去掉img外围标签p的代码,比起p来说,我更喜欢div:
word-wrap: break-word; background-image: url(http://zhuqidong.gotoip2.com/templets/caizi/images/code-bg.png); background-color: rgb(255, 255, 255);\">//去掉图片外围标签p function img_unautop($pee) { $pee = preg_replace('/\\\\s*?( <\\\\/a>| )?\\\\s*<\\\\/p>/s', '$1', $pee); return $pee; } add_filter( 'the_content', 'img_unautop', 30 );
把这段代码放到主题的functions.php里面就行了!所有文章中的img标签只要外围第一层有p的都将替换成div!这下可以让你在广袤的土地上肆意发挥设计的灵感了~
注意:使用此方法有可能导致某些文章内容被替换,使用后请即使检查各文章内容有没被替换。