How can I center this text FOR MOBILE only?? I am unable to do it through editor
Topic summary
A Shopify store owner using the Sahara theme needs to center banner text specifically for mobile devices, which cannot be achieved through the standard editor.
Solution Provided:
- Add custom CSS code to the theme’s stylesheet (base.css, style.css, or theme.css)
- Use a media query targeting screens up to 749px width
- Apply absolute positioning with transform properties to center the
.hero-banner .hero__contentelement
Current Status:
- The initial centering solution successfully worked
- The user now requests a minor adjustment to lower the text position slightly
- Discussion remains open for fine-tuning the vertical placement
1 Like
Try this one.
- From your Shopify admin dashboard, click on “Online Store” and then “Themes”.
- Find the theme that you want to edit and click on “Actions” and then “Edit code”.
- In the “Assets” folder, click on “base.css, style.css or theme.css” file, depending on which file your theme uses to store its CSS styles. At the bottom of the file, add the following CSS code:
@media only screen and (max-width: 749px){
.hero-banner .hero__content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
-
And Save.
-
Result:
Your Feedback Matters! Please mark the solution and give likes to posts that helped you. Your appreciation fuels our motivation to assist you better!
1 Like
That worked, thank you so much - but can I lower it a tiny bit more with that code?

