简体   繁体   English

Zurb基金会 - 博客文章中的中心图像

[英]Zurb Foundation - Centre images in blog posts

I'm new to foundation and i am building a blog based off the Simple Blog template. 我是基础新手,我正在建立一个基于简单博客模板的博客。 The images are currently appearing like this however I would like them to appear in the middle. 图像目前看起来像这样,但我希望它们出现在中间。 How would I do this? 我该怎么做?

This is the current code I have for my posts: 这是我对帖子的当前代码:

<div id="posts" class="row medium-8 large-7 columns">
{% for i in object_list %}
<a href="{{i.get_absolute_url }}" style="color:dimgrey; text-decoration:none">
    <div class="blog-post">
        <h3 style="color: black;">{{ i.post_title }}<small> {{ i.post_date }}</small></h3>
        <hr> {% if i.post_image %}
        <img class="thumbnail" src="{{ i.post_image.url }}"> {% endif %}

        <p>{{ i.post_content|linebreaks }}</p>

        {% if instance.post_author.get_full_name %}
        <div class="callout">
            <ul class="menu simple">
                <li>Written By: {{ i.post_author.get_full_name }}</li>
            </ul>
        </div>
        {% endif %}
</a>
<br> 
{% endfor %}
</div>

Thanks, 谢谢,

-Will -将

You can use the below code to align the image at the center with respect to the main class of id posts: 您可以使用以下代码将中心的图像与主要类别的id帖子对齐:

div.row medium-8 large-7 columns
{
    position: relative;
}
div.row medium-8 large-7 columns img
{
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: [-50% of your image's width];
    margin-top: [-50% of your image's height];
}

You could wrap the image in a div and use the text-center class ( docs ): 您可以将图像包装在div并使用text-center类( docs ):

<div class="text-center">
    <img class="thumbnail" src="{{ i.post_image.url }}">
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM