微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – Bootstrap将图像与文本对齐

我正在尝试将左侧的图像与使用boostrap的文本对齐,并且当在移动设备上查看页面时,图像将以文本的顶部为中心!
<div class="container">
<div class="row">
    <h1>About Me</h1>
    </class>
     <div class="col-md-4">
     <div class="imgAbt">
        <img  width="220" height="220" src="img/me.jpg">
     </div>
     </div>
    <div class="col-md-8"><p>Lots of text here...With the four tiers of grids available you're bound to run into issues where,at certain breakpoints,your columns don't clear quite right as one is taller than the other. To fix that,use a combination of a .clearfix and o</p></div>
</div>
</div>

我也尝试过.col-md-3 .col-md-pull-9以及.col-md-9 .col-md-push-3,但是我仍然无法达到预期的结果,similar to this design

解决方法

Demo Fiddle

您有两个选择,可以更正您的标记,以便它使用正确的元素并使用Bootstrap网格系统:

<div class="container">
     <h1>About Me</h1>
    <div class="row">
        <div class="col-md-4">
            <div class="imgAbt">
                <img width="220" height="220" src="img/me.jpg" />
            </div>
        </div>
        <div class="col-md-8">
            <p>Lots of text here...With the four tiers of grids available you're bound to run into issues where,use a combination of a .clearfix and o</p>
        </div>
    </div>
</div>

或者,如果您希望文本紧密包装图像,请将您的标记更改为:

<div class="container">
    <h1>About Me</h1>
    <div class="row">
        <div class="col-md-12">
            <img style='float:left;width:200px;height:200px; margin-right:10px;' src="img/me.jpg" />
            <p>Lots of text here...With the four tiers of grids available you're bound to run into issues where,use a combination of a .clearfix and o</p>
        </div>
    </div>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Mip是什么意思以及作用有哪些
怎么测试Mip页面运行情况
MIP安装的具体步骤有哪些
HTML添加超链接、锚点的方法及作用详解(附视频)
MIP的规则有哪些
Mip轮播图组件中的重要属性讲解
Mip的内联框架组件是什么
怎么创建初始的MIP配置及模板文件
HTML实现多选框及无法提交多数据的原因分析(附视频)
HTML如何设置复选框、单选框以及默认选项?(图文+视频)