Created
October 7, 2015 04:02
-
-
Save henrytran9x/de2d7363b11a84b084fa to your computer and use it in GitHub Desktop.
Set Responsive Text Alignment in Bootstrap 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text-xs-left { text-align: left; } | |
.text-xs-right { text-align: right; } | |
.text-xs-center { text-align: center; } | |
.text-xs-justify { text-align: justify; } | |
@media (min-width: @screen-sm-min) { | |
.text-sm-left { text-align: left; } | |
.text-sm-right { text-align: right; } | |
.text-sm-center { text-align: center; } | |
.text-sm-justify { text-align: justify; } | |
} | |
@media (min-width: @screen-md-min) { | |
.text-md-left { text-align: left; } | |
.text-md-right { text-align: right; } | |
.text-md-center { text-align: center; } | |
.text-md-justify { text-align: justify; } | |
} | |
@media (min-width: @screen-lg-min) { | |
.text-lg-left { text-align: left; } | |
.text-lg-right { text-align: right; } | |
.text-lg-center { text-align: center; } | |
.text-lg-justify { text-align: justify; } | |
} | |
// For SASS | |
// .text-xs-left { text-align: left; } | |
// .text-xs-right { text-align: right; } | |
// .text-xs-center { text-align: center; } | |
// .text-xs-justify { text-align: justify; } | |
// @media (min-width: $screen-sm-min) { | |
// .text-sm-left { text-align: left; } | |
// .text-sm-right { text-align: right; } | |
// .text-sm-center { text-align: center; } | |
// .text-sm-justify { text-align: justify; } | |
// } | |
// @media (min-width: $screen-md-min) { | |
// .text-md-left { text-align: left; } | |
// .text-md-right { text-align: right; } | |
// .text-md-center { text-align: center; } | |
// .text-md-justify { text-align: justify; } | |
// } | |
//@media (min-width: $screen-lg-min) { | |
// .text-lg-left { text-align: left; } | |
// .text-lg-right { text-align: right; } | |
// .text-lg-center { text-align: center; } | |
// .text-lg-justify { text-align: justify; } | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bootstrap is great, almost perfect. One thing it’s missing is responsive text-align.
So I created a simple .less file that uses Bootstraps breakpoints and class naming format. It allows you use set specific text-align for specific breakpoints.