简体   繁体   English

Bootstrap v4推拉

[英]Bootstrap v4 push and pulls

So i have read this topic: Column order manipulation using col-lg-push and col-lg-pull in Twitter Bootstrap 3 因此,我已经阅读了以下主题: 在Twitter Bootstrap 3中使用col-lg-push和col-lg-pull进行列顺序操作

But i still have some problems: 但是我仍然有一些问题:

在此处输入图片说明

My code ( i have shortened it a bit, but i think nothing important is missing): 我的代码(我将其缩短了一点,但是我认为没有什么重要的东西丢失了):

    <div class="row justify-content-center">
        <div class="col-lg-8 col-md-12">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit...
        </div>
    <div class="col-lg-4 col-md-10 justify-content-center"  >
        /*My login div*/
    </div>

So, what i want to happen: on small screens i want my Login div be almost as wide as a screen (10/12 and centered), PLUS i want it float on the top of the screen, before the text. 所以,我想发生的事情:在小屏幕上,我希望我的Login div几乎与屏幕一样宽(10/12,居中),再加上我希望它浮动在屏幕顶部,文本之前。 I assume i have to add something like pull-sm-12 to my Login div and something like push-sm-10 to my Text div , but it doesn't work, my div just float beyond screen borders. 我假设我必须在Login div添加pull-sm-12东西,在Text div push-sm-10类的东西,但这是行不通的,我的div超出了屏幕边界。

Bootstrap 4 has moved to a full flexbox model, so the push/pull utilities are no more. Bootstrap 4已移至完整的flexbox模型,因此不再提供推/拉实用程序。 They are replaced by the "order" utilities . 它们由“ order”实用程序代替。 (Hint: The documentation seems to be out of date. Even though the class names start with order in the documentation, they actually start with flex , ie flex-first , not order-first .) Anyways, based on what you described, I think the following code will get you mostly there. (提示:文档似乎已过时。即使类名以文档中的order开头,它们实际上也以flex开头,即flex-first ,而不是order-first 。)无论如何,根据您的描述,我认为以下代码将带您到那里。

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/> <div class="d-flex flex-sm-wrap flex-md-nowrap justify-content-sm-center justify-content-md-start"> <div class="flex-sm-last flex-md-unordered"> Lorem ipsum dolor sit amet, consectetur adipiscing elit... </div> <div class="flex-sm-first flex-md-unordered" > Login box </div> </div> 

Unfortunately, the Stack Overflow snippet functionality doesn't really let you play with responsiveness. 不幸的是,Stack Overflow片段功能并不能真正让您发挥响应能力。 It's all defined widths, apparently. 显然,这都是定义的宽度。 You should copy the code somewhere else to play around with it. 您应该将代码复制到其他地方以进行操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM