I'm trying to add Bootstrap offset class in my code to achieve diagonal alignment like this:
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.
col-md-offset-* to leave a particular number of virtual Bootstrap columns to the left of any column (kind of like invisible place holders).
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.
An offset is used to push columns over for more spacing. To use offsets on large displays, use the . col-md-offset-* classes.
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.
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.
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