Wordpress禁用图像下的文本环绕

时间:2017-05-29 22:18:40

标签: php html css wordpress wordpress-theming

以下是当前的问题: enter image description here

我想这样做,所以文字永远不会在图像下面。但这是wordpress,我想要一个适用于每个帖子的解决方案。那么CSS解决方案最好还是PHP解决方案?我不会选择Wordpress在div和段落中添加的内容。

以下是代码:

<p>
  <a href="http://amazon.com">
    <img class="alignleft wp-image-281" src="http://dock.com//Be_here_now_ram_dass.jpg" alt="Be Here Now Ram Dass" width="137" height="138" />
  </a>
  This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
</p>

相关CSS:

.entry-content p {
    font-size: 16px!important;
    overflow: hidden;
}
a img.alignleft {
    float: left;
}

我该如何解决这个问题?如果它是一个PHP解决方案,请详细说明放在哪里,等等。谢谢!

1 个答案:

答案 0 :(得分:0)

您可以将段落文本包装在块元素中并将其设置为$string = '<div>#Α#</div><div i="">#Α#</div><div i=""><a href="#Β#" class="" s="" p="65" t="4"></a><a href="#Β#" class="" s="" p="65" t="4"></a><a href="#Β#" class="" s="" p="68" t="4"></a><a href="#Β#" class="" s=""></a><a href="#Β#" class="" s="" p="75" t="2"></a><a href="#Β#" class="" s=""></a><a href="#Β#" class="" s="" p="65" t="3"></a><a href="#Β#" class="" s="" p="60" t="4"></a><a href="#Β#" class="" s=""></a><a href="#Β#" class="" s="" p="60" t="4"></a><a href="#Β#" class="" s="sv_plus" p="75" t="3"></a><noscript><center><h1 style="color:red;font-size:50px">#A#</h1></center><div>#Α#</div></noscript><div>#Α#</div>'; preg_match_all("/\#A\#/",$string,$matches); print_r($matches); //return only one match instead 5 preg_match_all("/\#B\#/",$string,$matches); print_r($matches); //return zero matches instead 11 ,以便内联内容不会流出并环绕浮动元素。

overflow: auto
.alignleft {
  float: left;
}

.content {
  font-size: 3rem;
  overflow: auto;
  display: block;
}

相关问题