Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap col-md-offset not working?

I'm using react and trying to render following :

render(){
return(
  <div className="col-md-12">
    <h1 className="col-md-6 col-md-offset-6">To do App</h1>


    <form onSubmit={this.handleSubmit}>
      <input onChange={this.handleChange} value={this.state.text}/>
      <button>Add {this.state.items.length+1}</button>
    </form>


    <Todolist items={this.state.items}/> 
  </div>
)
}

col-md-6 is working but col-md-offset-6 is not working ?? I'm using bootstrap 4.

like image 543
ashukid Avatar asked Dec 22 '17 14:12

ashukid


People also ask

How do I fix Col Md offset in bootstrap?

Since bootstrap 4, the col-*-offset-* class was replaced with offset-*-* where the first * is the responsiveness (sm, md, lg, etc) and the second * is the number of columns (eg. 1, 2, 3, etc). To fix it for bootstrap 4 and 5, simply change the class to offset-md-* .

What is Col Md offset in bootstrap?

col-md-offset-* to leave a particular number of virtual Bootstrap columns to the left of any column (kind of like invisible place holders).

How do I offset a column in bootstrap 4?

Bootstrap By Building Projects - Includes Bootstrap 4 An offset is used to push columns over for more spacing. To use offsets on large displays, use the . col-md-offset-* classes.

How does bootstrap offset work?

Offsets are used for spacing elements in the responsive grid. The unit is based on the column layout. Means that in the medium range of the grid system, the element will have a width of 6 colums and there will be 3 blank columns before the element (and as a consequence, will have 3 blank colums after).


2 Answers

.col-*-offset-* was removed in Bootstrap 4. The new syntax is simply .offset-*-* so you should be using .offset-md-6 in your above code.

You can learn more about offsetting Bootstrap's Grid columns on their 4.x documentation:

https://getbootstrap.com/docs/4.0/layout/grid/#offsetting-columns

like image 193
Robert Avatar answered Sep 28 '22 02:09

Robert


You have to change the format of offset to offset-md-6 in place of col-md-offset-6.

The Bootstrap 3 was supporting the format col--offset-* but in Bootsrap 4 the format is like offset--*

like image 37
Vatsal Dave Avatar answered Sep 28 '22 02:09

Vatsal Dave