Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap col-md-offset-* not working

I'm trying to add Bootstrap offset class in my code to achieve diagonal alignment like this:

Image

But I don't know what offset should I use. I've tried couple of offsets to achieve this but no use.Text is covering whole jumbotron.Here is my code

Html:

<div class="jumbotron">         <div class="container">             <div class="row">                 <div>                     <h2 class="col-md-4 col-md-offset-4">Browse.</h2>                     <h2 class="col-md-4 col-md-offset-4">create.</h2>                     <h2 class="col-md-4 col-md-offset-4">share.</h2>                 </div>             </div>         </div>     </div> 

CSS:

.jumbotron {     height: 500px;     width: 100%;     background-image: url(img/bg.jpg);     background-size: cover;     background-position: center; }  .jumbotron h2 {     color: white;     font-size: 60px; }  .jumbotron h2:first-child {     margin: 120px 0 0; } 

Please guide me.Thank you in advance.

like image 509
Aisha Salman Avatar asked Jul 13 '16 16:07

Aisha Salman


People also ask

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 in Bootstrap 4?

This is the equivalent of setting margin-left: auto in your CSS, which is effectively saying "push this as far left as you can." By using both ml-*-auto and mr-*-auto , you can effectively center your columns. This is the full list of prefixes for the auto property: ml- margin left. mr- margin right.

How do I offset in Bootstrap?

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

What is Col MD 4 in Bootstrap?

col-md-4: This class is used when the device size is medium or greater than 768px and the maximum width of container is 720px and you want the width equal to 4 columns.


1 Answers

It works in bootstrap 4, there were some changes in documentation.We don't need prefix col-, just offset-md-3 e.g.

<div class="row">    <div class="offset-md-3 col-md-6"> Some content...    </div> </div> 

Here doc.

like image 109
Vasyl Gutnyk Avatar answered Oct 06 '22 17:10

Vasyl Gutnyk