Responsive text alignment
See original GitHub issueI frequently build layouts where I’d like to change the text alignment based on breakpoint. For example, I’ll have two columns on desktop: image in the left column, left-aligned text in the right column. On mobile, when the columns stack vertically, I’d like to center the text instead of keeping it left-aligned.
As far as I can tell, there’s no way to do this because the align
property of <mj-text>
applies to both breakpoints.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Change text-align responsively (with Bootstrap 3)?
Although the provided solution is absolutely right, I think there is a different approach that could be interesting. Bootstrap does not provide alignment...
Read more >Responsive Text Align - CodePen
An unusual celestial object called CX330 was first detected as a source of X-ray light in 2009. It has been launching “jets” of...
Read more >CSS Text Alignment and Text Direction - W3Schools
The text-align property is used to set the horizontal alignment of a text. A text can be left or right aligned, centered, or...
Read more >Live Demo: Bootstrap Responsive Text Alignment
Text will be center aligned on extra-large sized (xl) viewports and up. Note: Open the output in a new blank tab (Click the...
Read more >Bootstrap 4 Responsive Alignment on Codeply
Example of the new reponsive floats and text alignment for Bootstrap 4. Now you can align differently at different widths. Pull right only...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A simple media query will help you do that: https://mjml.io/try-it-live/rJ17Da6mX
Note that it’s better to use the default styles for the mobile layout (center), and then use a media query for the responsive behaviour on desktop (media queries are better supported in desktop clients).
I might have a solution for that problem, it still needs to be tested all-around, but… If you declare, in your mj-all tag in mj-head, that default align for everything is “none”, rather than left/center/right (or omitting to declare which results in align=“center”), you might end up with an argument error in your HTML, but it surely can be overridden by inline styling and media queries.
<td align="none">
I hope it’s gonna pass the final tests. But for now, M$ LookOut and Gmail are okay!