Home › Forums › Support › Having text display properly in mobile for WooCommerce info/message/error banner
- This topic has 10 replies, 2 voices, and was last updated 5 years ago by
David.
-
AuthorPosts
-
March 6, 2021 at 8:53 pm #1685052
Dominique
Hi,
In mobile view the WooCommerce info/message/error banner wraps the text to the left and around the continue shopping button. .woocommerce-info, .woocommerce-message, .woocommerce-error
How can I have the message text appear on top centered and the button underneath centered so it actually looks like an adult did it instead of a 7 year old. A bit a padding between the message and button would make it look even more appropriate.
Please advise
March 7, 2021 at 6:04 am #1685331David
StaffCustomer SupportHi there,
try this CSS:
@media(max-width: 600px) { .woocommerce-info, .woocommerce-message { display: flex; flex-direction: column-reverse; text-align: center; } .woocommerce .woocommerce-info .button, .woocommerce .woocommerce-message .button { display: block; margin-top: 10px; } }March 7, 2021 at 6:12 am #1685336Dominique
Hi,
Not 768px?
Do I have to add .woocommerce-error?
Like this:
@media(max-width: 768px) { .woocommerce-info,.woocommerce-message, .woocommerce-error { display: flex; flex-direction: column-reverse; text-align: center; } .woocommerce .woocommerce-info .button, .woocommerce .woocommerce-message .button, .woocommerce-error .button { display: block; margin-top: 10px; } }March 7, 2021 at 6:22 am #1685342Dominique
Hi,
The button is taking the whole width of the screen.
I lost my 10 px right and left.
Please advise
March 7, 2021 at 6:50 am #1685555Dominique
Hi,
@media(max-width: 768px) { .woocommerce-info, .woocommerce-message, .woocommerce-error { display: flex; flex-direction: column-reverse; text-align: center; } .woocommerce .woocommerce-info .button, .woocommerce .woocommerce-message .button, .woocommerce-error .button { display: block; margin-top: 10px; margin-right: auto; margin-left: auto; } }It’s a good? 🙂
March 7, 2021 at 8:49 am #1685665David
StaffCustomer SupportLooks good to me.
Couple of points:1.
woocommerce-erroris not required in this instance – but you may have a similar issue with the error notices.2. The
600pxvs768px– you can set the value to wherever you want the content to be stacked. Simply resize the browser to see where its necessary for the content to stack.March 7, 2021 at 8:57 am #1685672Dominique
Hi,
Other points.
Since
flex-direction: column-reverse;is used some messages are displayed in reversed order. I removed the selector.woocommerce-infoeverywhere.Most likely as you mentioned
.woocommerce-infois not needed also as there are no buttons within those messages I think. I need to generate some errors. Don’t know how to…March 7, 2021 at 9:00 am #1685677Dominique
Oups typo
Most likely as you mentioned
.woocommerce-erroris not needed also as there are no buttons within those messages I think. I need to generate some errors. Don’t know how to…March 8, 2021 at 4:57 am #1686463David
StaffCustomer SupportYep – that makes sense. Errors – most likely will be found on Checkout if users miss out key fields.
March 8, 2021 at 7:12 am #1686814Dominique
Hi,
Worse case if there’s a button in an error message it will just look like a 7 year old coded it.
If it can help anyone else evised code:
@media(max-width: 768px) { .woocommerce-message { display: flex; flex-direction: column-reverse; text-align: center; } .woocommerce .woocommerce-message .button { display: block; margin-top: 10px; margin-right: auto; margin-left: auto; } }Thanks for your help.
March 8, 2021 at 7:55 am #1686873David
StaffCustomer Support🙂
Glad to be of help. -
AuthorPosts
- You must be logged in to reply to this topic.