html - 当标题位于响应式 View 中的不同列中时,将标题移到图像上方

标签 html css twitter-bootstrap responsive-design

我在桌面 View 中并排显示两栏中的图像和博客摘录,但在移动 View 中我希望博客标题位于图像上方。我不确定如何执行此操作,因为它们位于 2 列中,或者是否有更简单的方法来定位图像?

    <div class="blogposts">
    <article class="one-post">
        <div class="blogposts-thumbs col-xs-12 col-sm-4">
            <?php
            if ( has_post_thumbnail() ) {
                the_post_thumbnail('',array('class' => 'img-fluid'));
            }
            ?>
        </div>
        <div class="blogposts-excerpts col-xs-12 col-sm-8">
            <h3><a href="page.html"><?php the_title(); ?></a></h3>
            <ul class="date-info">
            <li class="post-date"><?php echo get_the_date(); ?></li>
            <li><?php the_tags(); ?></li>
        </ul>
        <p><?php the_excerpt(); ?></p>
        <span><a href="single-post.html">Continue reading <i class="fa fa-angle-double-right" aria-hidden="true"></i>
    </article>
    </div>

最佳答案

您可以使用.hidden-xs.visible-xs 类在移动设备中显示和隐藏

<div class="blogposts">
    <article class="one-post">
        <div class="blogposts-thumbs col-xs-12 col-sm-4">

            <h3 class="visible-xs"><a href="page.html"><?php the_title(); ?></a></h3>

            <?php
            if ( has_post_thumbnail() ) {
                the_post_thumbnail('',array('class' => 'img-fluid'));
            }
            ?>
        </div>
        <div class="blogposts-excerpts col-xs-12 col-sm-8">

            <h3  class="hidden-xs"><a href="page.html"><?php the_title(); ?></a></h3>

            <ul class="date-info">
            <li class="post-date"><?php echo get_the_date(); ?></li>
            <li><?php the_tags(); ?></li>
        </ul>
        <p><?php the_excerpt(); ?></p>
        <span><a href="single-post.html">Continue reading <i class="fa fa-angle-double-right" aria-hidden="true"></i>
    </article>
</div>

关于html - 当标题位于响应式 View 中的不同列中时,将标题移到图像上方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46564039/

相关文章:

html - 导航栏不会在智能手机设备上居中

javascript - 如何将整个页面保存为一个文件以便离线工作(包括外部 javascript)?

html - 如何修改此代码以使其适用于 IE 11?

html - 100% 缩放时看起来不错,但当我缩小时,一切都错了

html - 如果屏幕很小,旧浏览器,Twitter bootstrap 3 导航栏下拉菜单不会显示所有元素

javascript - Angular : Bootstrap typeahead with multiselect

jquery - Bootstrap 弹出窗口 : Align on top right

javascript - 将 x-webkit-speech 与文本区域一起使用

javascript - 使用 anchor 标记的 div 上的 Jquery Scroll 无法正常工作

html - 100 % 高度 - 带标题的相对 div