Design comparison
Solution retrospective
Hi all.
I was left a little confused as to why 'text-align: center' on my .card class wasn't working when I tried setting my paragraph to 'max-inline-size: xxch'. When ever I did this, it would push the entire paragraph off to the left in an odd way.
To correct the issue I ended up setting 'margin: 0 auto' on my .text class. So I'm just wondering is 'max-inline-size' the correct way to set line length? Or which is the preffered method, that would not have affected the centering?
Thankyou for any feedback.
Community feedback
- @denieldenPosted almost 3 years ago
Hi Nick, great job!
text-align: center
works great ... if you try to reduce thewidth
of the card to22rem
you will see that the text aligns in the center.It seems to you that it doesn't work because the text has room to stay on only two lines and randomly ends up as if it were justified.
So it would have been enough to add some lateral
padding
to thep
. Here's what themax-inline-size
property does exactly:The max-inline-size CSS property defines the horizontal or vertical maximum size of an element's block, depending on its writing mode. It corresponds to either the max-width or the max-height property, depending on the value of writing-mode.
Hope this help ;)
Marked as helpful2@NickODxyzPosted almost 3 years agoThankyou @denielden that makes more sense now actually.
I appreciate the tips.
Nick
1 - @enesoeztekinPosted almost 3 years ago
Great job! Your solution looks the same. About your question, why didn't you use "line-height" property to set the height of your text?
1@NickODxyzPosted almost 3 years ago@enesoeztekin I may have missed some styling, I will have to check my work again. Thank you.
1 - @NaveenGumastePosted almost 3 years ago
Hay ! Good Nick Job you made it look nearly perfect to the preview
Keep up the good work!
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord