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.
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-* .
col-md-offset-* to leave a particular number of virtual Bootstrap columns to the left of any column (kind of like invisible place holders).
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.
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).
.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
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--*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With