图像与标题不匹配

时间:2014-03-14 12:07:30

标签: php wordpress

有些人可以帮忙吗?

我有这个代码可以连续打印4张图片文章。

    <article>

<div class="post-thumbnail img">

<?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif; ?>

</div>
<!--/.post-thumbnail-->

</article>

enter image description here

任何时候我尝试添加字幕,它都不会再停留在一行。像这样

<article>

<div class="post-thumbnail img">

<?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif; ?>

</div>
<div class="post-thumbnail img">
<?php the_title();?>

</div>
<!--/.post-thumbnail-->

</article>

会发生什么,第一个图像文本将在图像下方,其余部分将在顶部。但是所有这些都需要低于这些图像。 enter image description here 任何解决方案?

CSS`

.post-thumbnail img { 
    height: auto;
    margin-bottom: -16px;

    float: left;
    width: 23.0%; 
     margin-right: 2%}

`

1 个答案:

答案 0 :(得分:0)

您应该向我们提供PHP函数生成的HTML代码。

到目前为止,我还不知道你的CSS代码是否犯了错误:

/* .post-thumbnail img = get the <img> inside a <div class="post-thumbnail"> */
/* .post-thumbnail.img = get the <div class="post-thumbnail img"> */
.post-thumbnail.img { 
    height: auto;
    margin-bottom: -16px;
    float: left;
    width: 23.0%; 
    margin-right: 2%;
}

希望有所帮助。

相关问题