【发布时间】:2018-06-23 23:07:43
【问题描述】:
我在这里搜索过,但找不到适合我的解决方案。我试过以下 Align image to the center both vertically and horizontally Image center align vertically and horizontally 还有一些我发现的。
我有 2 列。第一个有一个图像 500px X 500px 第二个有文字
我需要垂直和水平对齐图像中心。当在移动视图上时,图像应该出现在文本上方/居中。
<section id="what">
<div class="row">
<div class="col-md-6 box-image"><img class="box-image" src="http://chalkgallerylewes.co.uk/wp-content/uploads/2013/08/Placeholder-500x500px.png"></div>
<div class="col-md-6">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</p>
<ul>
<li>Placeholder list </li>
<li>Placeholder list </li>
<li>Placeholder list </li>
<li>Placeholder list </li>
<li>Placeholder list </li>
</ul>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</p>
</div>
</div>
</section>
我用我一直在尝试的一种方法制作了一个 JF Fiddle。
【问题讨论】:
-
我猜问题出在引导程序上。您在 col-md-6 中有相对位置
-
这是您要找的布局吗? jsfiddle.net/sol_b/rrdfLpyj/3
-
不,图片应该与桌面上的文字并排。
-
@DaveYme 它在我身边……你看到了什么?
-
@sol 它位于文本上方。即使我拉伸到全屏。
标签: html css twitter-bootstrap-3