在Wordpress中的内联元素之间添加换行符标记,导致布局损坏

时间:2016-02-15 19:13:34

标签: html css wordpress

我正在设计一些下载链接,这些链接在JSfiddle中测试时似乎没问题。但是,当插入到WordPress中的相同代码时,由于某种原因,.title类被强制在容器之外?

网站:http://79.170.44.103/113events-temp.co.uk/cotswold-113/downloads/

提前致谢。

.item-listing .item {
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    display: block;
    height: 60px;
    margin-bottom: 10px;
    padding: 20px 10px 0 110px;
    position: relative;
    text-decoration: none !important;
}
.item-listing .item:hover {
    background: #f0f0f0;
    border-color: #ccc;
}
.item-listing .item .icon {
    position: absolute;
    font-size: 3rem;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border-right: 1px solid #e5e5e5;
    padding: 20px 20px;
    line-height: 40px;
    -webkit-transition: all 0.1s ease-in-out;
    -moz-transition: all 0.1s ease-in-out;
    -ms-transition: all 0.1s ease-in-out;
    -o-transition: all 0.1s ease-in-out;
    transition: all 0.1s ease-in-out;
}
.item-listing .item .title {
    color: #222222;
    display: block;
    font-size: 18px;
}
.item-listing .item .subtitle {
    color: #b4b4b4;
    display: block;
    font-size: 14px;
}
<div class="item-listing">
  <a href="#" class="item type-link" target="_blank">
    <span class="icon"><i class="fa fa-download"></i></span>
    <span class="title">Document Title</span>
    <span class="subtitle">File type, pdf for example</span>
  </a>
  <a href="#" class="item type-link" target="_blank">
    <span class="icon"><i class="fa fa-download"></i></span>
    <span class="title">Document Title</span>
    <span class="subtitle">File type, pdf for example</span>
  </a>
  <a href="#" class="item type-link" target="_blank">
    <span class="icon"><i class="fa fa-download"></i></span>
    <span class="title">Document Title</span>
    <span class="subtitle">File type, pdf for example</span>
  </a>
  <a href="#" class="item type-link" target="_blank">
    <span class="icon"><i class="fa fa-download"></i></span>
    <span class="title">Document Title</span>
    <span class="subtitle">File type, pdf for example</span>
  </a>
  <a href="#" class="item type-link" target="_blank">
    <span class="icon"><i class="fa fa-download"></i></span>
    <span class="title">Document Title</span>
    <span class="subtitle">File type, pdf for example</span>
  </a>
</div>

4 个答案:

答案 0 :(得分:2)

不幸的是,当您在&#34; text&#34;之间切换时,WordPress编辑器可能会出错。和&#34;视觉&#34;编辑。由于span是一个内联元素,我唯一能找到解决问题的方法(没有完全禁用wpautop)就是使代码内联:

<span class="icon"><i class="fa fa-download"></i></span><span class="title">Document Title</span><span class="subtitle">File type, pdf for example</span>

而不是:

<span class="icon"><i class="fa fa-download"></i></span>
<span class="title">Document Title</span>
<span class="subtitle">File type, pdf for example</span>

或者,您可以专门删除该页面上的wpautop(不影响其他页面):

add_filter('the_content', 'remove_autop', 9);
function remove_autop($content) {
    if ( is_page(227) ) {
        remove_filter( 'the_content', 'wpautop' );
    }
    return $content;
}

答案 1 :(得分:1)

Wordpress似乎会自动为您的输出添加一堆set.seed(1001) x1 <- rbetabinom(n=1000, prob=0.1, size=50, theta=10) dmybetabinom <- function(x, N, theta, p, log=FALSE) { (choose(N,x)*beta(N-x+theta*(1-p),x+theta*p))/beta(theta*(1-p),theta*p) } 标签。如果您通过编辑器输入菜单,则需要确保将其添加为原始HTML。我认为WordPress有一个名为dbetabinom(0:9,size=9,theta=4, prob=0.5) [1] 0.04545455 0.08181818 0.10909091 0.12727273 0.13636364 0.13636364 0.12727273 0.10909091 [9] 0.08181818 0.04545455 dmybetabinom(0:9,N=9,theta=4, p=0.5) [1] 0.04545455 0.08181818 0.10909091 0.12727273 0.13636364 0.13636364 0.12727273 0.10909091 [9] 0.08181818 0.04545455 的过滤器,如果是这种情况你就想要禁用它。

答案 2 :(得分:0)

这是因为在wordpress documentation中有生成br(break)标签。 你必须删除它们。我猜你在wordpress可视化编辑器中使用这个代码。尽量避免使用可视化编辑器,而是使用文本编辑器。

答案 3 :(得分:0)

然后只需在functions.php中添加以下代码

Enter a positive number to generate random numbers 4
41
18467
6334
26500

randomly generated numbers after sorting
41
18467
6334
26500
Press any key to continue . . .