使用 bootstrap 3 的文章推/拉对齐 [英] Article push/pull alignment using bootstrap 3
本文介绍了使用 bootstrap 3 的文章推/拉对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 bootstrap 3,并尝试为桌面上的文章设置特定的网格对齐方式.
在移动设备上,我想这样订购文章的内容:
- 标题
- 图片
- 内容
在桌面上,我想要左边的图片和右边的标题和内容.
这是我的代码
有没有一种简单的方法可以得到我想要的东西?
解决方案 基于 是否可以使用 Bootstrap 实现这种移动/桌面布局?(或其他网格)
css:
.floatright{float:right;}@media(最大宽度:768px){.floatright{浮动:无;}}
html:
<文章类=行"><header class="col-md-8 floatright"><a href="#"><h2>标题</h2></a></标题><div class="col-md-4"><图><a class="thumbnail" href="#"><img src="..." alt="4x3 Image" class="img-responsive"><figcaption>Caption</figcaption></a></图><div class="col-md-8 floatright"><p>内容</p>
</文章>
I'm using bootstrap 3 and I try to have a specific grid alignment for article on desktop.
On mobile I want to order content of the article like that :
- Title
- Image
- Content
On desktop, I want the image on the left and the title and content on the right.
Here is my code
<article class="row">
<header class="col-md-8 col-md-push-4">
<a href="#">
<h2>Title</h2>
</a>
</header>
<div class="col-md-4 col-md-pull-8">
<figure>
<a class="thumbnail" href="#">
<img src="..." alt="4x3 Image" class="img-responsive">
<figcaption>Caption</figcaption>
</a>
</figure>
</div>
<div class="col-md-8 col-md-push-4">
<p>Content</p>
</div>
</article>
But with this code, the content is on the right but under the image.
Is there a simple way to get what I want ?
解决方案
Based on Possible to achieve this Mobile/Desktop layout using Bootstrap? (or other grid)
css:
.floatright{float:right;}
@media (max-width: 768px)
{
.floatright{float:none;}
}
html:
<div class="container" style="background-color:green">
<article class="row">
<header class="col-md-8 floatright">
<a href="#">
<h2>Title</h2>
</a>
</header>
<div class="col-md-4">
<figure>
<a class="thumbnail" href="#">
<img src="..." alt="4x3 Image" class="img-responsive">
<figcaption>Caption</figcaption>
</a>
</figure>
</div>
<div class="col-md-8 floatright">
<p>Content</p>
</div>
</article>
</div>
这篇关于使用 bootstrap 3 的文章推/拉对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文