3 comments

@Zim 2017-08-12 17:09:49

Bootstrap 4 offset classes were temporarily removed in Beta 1, but were restored in Beta 2.

The class names col-{breakpoint}-offset-* were replaced with offset-{breakpoint}-*

The new auto-margins also work for offsetting columns will move the column over as much as possible. So, it depends on how much you want to "push" the column to the right. If they're no other columns to the right of the col-md-4 it will go all the way if to right side of the row. Basically offset was relevant for floated columns but is no longer relevant now that Bootstrap 4 is flexbox.

If you want to move the col-md-4 over just 2 column units, the best way would be to use a dummy/placeholder column...

<div class="row">
      <div class="col-md-2"></div>
      <div class="col-md-4">
            ..
      </div>
</div>

https://www.codeply.com/go/SqrQIOAY7

If there are other col-md-4 to the right of the first, then ml-auto and mr-auto would work to center both columns...

<div class="row">
        <div class="col-md-4 ml-auto">
            .
        </div>
        <div class="col-md-4 mr-auto">
            .
        </div>
</div>

https://www.codeply.com/go/SqrQIOAY7n

If you want to center the col-md-4 then simply use mx-auto to create equal margins on both sides.


Note: specific column offsets will be restored as of Beta 2

@Prashant Sharma 2017-08-12 17:20:10

Thanks but this blank div with col-md-2 seems like a "Hack" no?, this is what i used before posting this question. I will use your 2nd solution as i have another col-md-4 to the right, i will let you know if this solves my issue.

@Zim 2017-08-12 17:23:29

It may seem like a hack, but it's the only solution now that the offsets have been replaced by auto margins.

@Prashant Sharma 2017-08-12 17:26:58

Thanks alot for your tip , your 2nd solution worked for me and i guess for time being i will use a blank div on other places till Bootstrap get something new for offsetting.

@BBaysinger 2017-12-12 00:11:39

I'm a little confused. You're saying offset is no longer relevant now that Bootstrap 4 is flexbox, but that they will be restored? Why would they restore them if they aren't relevant?

@BBaysinger 2017-12-12 00:12:29

Beta2 is out now. Has offset been restored?

@clamchoda 2018-01-02 22:09:18

Changing

offset-md-2

to:

col-md-offset-2

Worked for me

@fWd82 2018-06-03 23:40:28

No. This isn't working in Bootstrap v4.0.0-beta. as specified in question.

@Oliver Ni 2017-08-12 13:47:50

ml-md-auto sets margin-left: auto; for sizes md and above.

You can't set that to something like 2.

You need to do ml-md-auto.

@Prashant Sharma 2017-08-12 13:55:46

I am using Bootstrap v4 Beta , you provided doc link of Alpha version. Updated my question with link of docs.

@Prashant Sharma 2017-08-12 14:01:33

Oliver when i try to use ml-md-auto it offsets 4 columns, what i want is offsetting 2 columns but with having col-md-4

@Oliver Ni 2017-08-12 14:04:27

@PrashantSharma It will offset as much as it can. What you can do is set the next column to have that class as well to fix it.

Related Questions

Sponsored Content

6 Answered Questions

[SOLVED] What is sr-only in Bootstrap 3?

20 Answered Questions

[SOLVED] How do CSS triangles work?

12 Answered Questions

[SOLVED] Change navbar color in Twitter Bootstrap

33 Answered Questions

[SOLVED] Center a column using Twitter Bootstrap 3

42 Answered Questions

33 Answered Questions

[SOLVED] How can I make Bootstrap columns all the same height?

23 Answered Questions

[SOLVED] vertical-align with Bootstrap 3

Sponsored Content