CSS   发布时间:2022-04-17  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了css – 使用bootstrap 3进行文章推/拉对齐大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用bootstrap 3,我尝试在桌面上为文章设置特定的网格对齐.

在移动设备上我想订购文章的内容,如:

>标题
>图片
>内容

在桌面上,我想要左边的图像和右边的标题和内容.

Alignment i want http://f.cl.ly/items/300e2K3V3H3c3f3F3p0q/Napkin%2027.09.13%209.47.05%20AM.png

这是我的代码

<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>

但是使用此代码,内容位于右侧,但位于图像下方.

http://f.cl.ly/items/1T3f093W2I0m3Q1E360g/Napkin%2027.09.13%2010.56.59%20AM.png

有没有一种简单的方法来获得我想要的东西?

解决方法

基于 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>

大佬总结

以上是大佬教程为你收集整理的css – 使用bootstrap 3进行文章推/拉对齐全部内容,希望文章能够帮你解决css – 使用bootstrap 3进行文章推/拉对齐所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。