html - 如何在移动屏幕上的文本顶部对齐右侧图像

标签 html css twitter-bootstrap mobile responsive-design

我在网页上有两行:在第一行,图像在左侧,文本在右侧。对于第二行,反之亦然。当我在移动设备上查看页面时,左侧的图像位于文本的顶部,右侧的图像位于文本的底部。

我希望所有图片都位于文本的顶部,无论是在屏幕的右侧还是左侧。

我应该怎么做?

HTML代码

<section class="pagecontent first_row" id="pagecontent">
    <div class="container">
        <div class="row">
            <div class="col-md-5 text-center animated wow fadeInLeft">
                <div class="iphone1">
                    <img src="images/image1.png" alt="" titl="">
                </div>
            </div>

            <div class="col-md-7 animated wow fadeInRight">
                <div class="features_list1">
                    <h1 class="text-uppercase">Text on Right</h1>
                    <p>Some text</p>
                </div>                  
            </div>
        </div>
    <hr class="style3">
    </div>
</section>

<section class="pagecontent second_row" id="pagecontent">
    <div class="container">
        <div class="row">
            <div class="col-md-7 animated wow fadeInLeft">
                 <div class="features_list1">
                     <h1 class="text-uppercase">Text on Left</h1>
                     <p>Some text</p>
                </div>  
            </div>

            <div class="col-md-5 text-center animated wow fadeInRight">
                <div class="iphone1">
                    <img src="images/image2.png" alt="" titl="">
                </div>  
            </div>
        </div>
        <hr class="style3">
    </div>
</section>

一些CSS代码

.pagecontent .iphone1{
    max-width: 359px;
    position: relative;
    display: inline-block;
    text-align: center;
}

.pagecontent .iphone1 img{
    width: 100%;
    height: auto;
    padding-bottom: 15px;
}
 .pagecontent .features_list1 p{
    color: #767272;
    font-family: "open_regular", Helvetica, Arial, sans-serif;
    font-size: 14px;
    margin-bottom: 19px;
    text-align: justify;
}

任何帮助都是有用的。

最佳答案

col-push-*col-pull-* 可以帮助你

<div class="container">
  <div class="row">
    <div class="col-md-5 text-center animated wow fadeInRight col-md-push-7">
  <div class="iphone1">
    <img src="http://placehold.it/150x150" alt="" titl="">
  </div>
</div>

<div class="col-md-7 animated wow fadeInLeft col-md-pull-5">
  <div class="features_list1">
    <h1 class="text-uppercase">Text on Left</h1>
    <p>Some text</p>
  </div>
    </div>
  </div>
</div>

您可以在 JSFiddle 中看到

关于html - 如何在移动屏幕上的文本顶部对齐右侧图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34492375/

相关文章:

javascript - 如何在单击单选按钮时启用选项卡

javascript - 如何复制表格的特定部分?

twitter-bootstrap - 为什么第二种形式显示在 ot Bootstrap 容器区域之外?

CSS StyleSheet 未在我的网站上加载 - FF7(Ubuntu)?

html - 使用 Twitter Bootstrap 修复自定义图标的填充

html - 在桌面设备上 Bootstrap 三列意外行为

php - 通过 PHP 安全连接到 MySQL 数据库

javascript - HTML中的站点范围音量控制

html - 让一个 div 延伸到 CSS 中先前 div 的位置?

php - 如何将 "version"查询字符串添加到网页静态资源的URL中?