html - 使用 bootstrap 在文本周围定位图像

标签 html css twitter-bootstrap

做一个网站娱乐并尝试使用 Bootstrap 来做。我遇到了一个问题,试图将图像定位到网页右边缘附近某些文本的右侧。

使用 margin-top 和 margin-right 可以按我想要的方式移动图片,但使用 margin-bottom 似乎没有效果……这正是我需要的。知道我做错了什么吗?

这是我的代码笔的链接:https://codepen.io/gkunthara/pen/eRXmoP

相关代码:

HTML

<div class="second-content">

    <h2 class="second-header"> Bond Back Guarantee</h2>
    <p class="second-header-p text-left"> Moving homes in Sydney is 
stressful enough. With our end of lease cleaning service, getting your bond back has never been easier. Rest assured knowing that your real estate agent or landlord will accept your cleaning. If not, 
    just notify us within 72 hours and we'll gladly return to reclean any 
    problem areas - free of charge.</p>
    <img class="first-pic pull-right gap-right" src="firstpic.png">

</div>

CSS:

.second-content .first-pic {

width: 30%;
border: solid black;
margin-right: 100px;
margin-bottom: 50px; /* no effect /*

}

编辑:更新的 codepen 链接仅显示相关代码

最佳答案

根据您的codepen,您需要在文本之后添加图像,然后需要添加

float:left in this class second-header-p text-left

.second-header-p.text-left{
   float:left;
}

关于html - 使用 bootstrap 在文本周围定位图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45094571/

相关文章:

javascript - 如何获取最接近的id?

html - 如何在html中排列这5个图表?

CSS 重置不适用于 Firefox 和文本

CSS 覆盖 Wordpress(插板主题)

html - 如何让我的导航栏更细?

html - 超过 12 个带有水平滚动条的 Bootstrap 列

jquery - 单击标题时切换 Accordion 中的图标

CSS div 高度不会扩展

html - bootstrap .well 中不需要的边距底部

css - 是否可以轻松添加 col-xl-*?