I have html as:-
<footer> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-6 text-left"> <p> © 2015 example.com. All rights reserved. </p> </div> <div class="col-xs-12 col-sm-6 text-right"> <p> <a href="#"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-twitter"></i></a> <a href="#"><i class="fa fa-google-plus"></i></a> </p> </div> </div> </div> </footer>
From the code you can see that the column's text are left and right aligned respectively. However in the xs mode I like them to be center aligned. How can I do this using twitter bootstrap?
Add class . text-center to the parent div to align text or any item inside to the center.
Using the <center></center> tags One way to center text or put it in the middle of the page is to enclose it within <center></center> tags.
To just center the text inside an element, use text-align: center; This text is centered.
You can simply use the class . justify-content-between in combination with the class . d-flex to left align and right align text content within a <div> container in Bootstrap 4.
Responsive text alignment has been added in Bootstrap V4:
https://getbootstrap.com/docs/4.0/utilities/text/#text-alignment
For left, right, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.
<p class="text-sm-left">Left aligned text on viewports sized SM (small) or wider.</p>
<div class="text-lg-right text-center"> center in xs and right in lg devices </div>
text-lg-right
applies for large size only, so except large size text-center
will be applied for the rest of the sizes.
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