Bootstrap, pull-left for small devices

前端 未结 7 760
名媛妹妹
名媛妹妹 2020-12-05 00:31

I\'m building a site in Bootstrap 3. Is there anyway to make a element use the class pull-left on smaller devices and use pull-right on larger ones?

Something like:

7条回答
  •  半阙折子戏
    2020-12-05 00:44

    Yes. Create your own style. I don’t know what element you’re trying to float left/right, but create an application.css file and create a CSS class for it:

    /* default, mobile-first styles */
    .logo {
        float: left;
    }
    
    /* tablets and upwards */
    @media (min-width: 768px) {
        .logo {
            float: right;
        }
    }
    

    Don’t be afraid to write custom CSS. Bootstrap is meant to be exactly that: a bootstrap, a starter point.

提交回复
热议问题