Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to center images in CSS two column for mobile
Tagged: center image, css, html, Metro Pro, mobile, Responsive Two Column
- This topic has 6 replies, 2 voices, and was last updated 5 years ago by
DJ Carl.
-
AuthorPosts
-
October 25, 2020 at 4:17 am #501588
DJ Carl
ParticipantHello,
I'm using Metro Pro. I have two columns for the desktop and looks fine.
Problem: When I look at images on mobile they are not centered.
What is the CSS property to center images on mobile?<meta name="viewport" content="width=device-width, initial-scale=1"> * { box-sizing: border-box; } /* Create two equal columns that floats next to each other */ .column { float: left; width: 50%; padding: 5px; } /* Clear floats after the columns */ .row:after { content: ""; display: table; clear: both; } /* Responsive layout - makes the two columns stack on top of each other instead of next to each other */ @media screen and (max-width: 600px) { .column { width: 100%; } }
http://djcarl.com/_website/mobile-center.jpg<div class="row"> <div class="column" style="background-color:#FFF;"> <p style="text-align: center;"><img title="Kelly Clarkson and DJ Carl©" alt="Kelly Clarkson and DJ Carl©" src="https://djcarl.com/wp-content/uploads/kelly-clarkson-djcarl.jpg" width="280" height="160"/></p> </div> <!--column 2--> <div class="column" style="background-color:#FFF;"> <p style="text-align: center;"><img title="Stevie Wonder and DJ Carl©" alt="Stevie Wonder and DJ Carl©" src="https://djcarl.com/wp-content/uploads/stevie-wonder-djcarl.jpg" width="280" height="160"/></p> </div> </div>October 25, 2020 at 4:31 am #501589AnitaC
KeymasterHi Carl, we can't help with CSS from an image. We need a link to the page. This may be why your post go unanswered. Can you provide a link?
Need help with customization or troubleshooting? Reach out to me.
October 25, 2020 at 4:36 am #501590DJ Carl
ParticipantNo problem. Trying to center images for mobile...
https://djcarlcom.stage.site/
staging_mrtbjq
cgWcYCWTHNpYOctober 25, 2020 at 2:41 pm #501593AnitaC
KeymasterYou're using SCSS grid. You'll need to add this to the Additional CSS box to center that.
.home-top .row { display: contents; }The theme you're using is pretty old. It's no longer sold. I see some other things that are kinda wonky in there that may require customization.
Need help with customization or troubleshooting? Reach out to me.
October 25, 2020 at 7:22 pm #501596DJ Carl
ParticipantHi, Anita,
Thanks for the response. Appreciate it mightly...I'm using the StudioPress Metro Pro theme. I have an old site and working on the Metro Pro theme site on a staging platform...
If you look at the HOME PAGE - https://djcarlcom.stage.site/. The pictures are not centering on mobile...
HELP...
PASSWORD:
staging_mrtbjq
cgWcYCWTHNpYOctober 26, 2020 at 2:35 am #501599AnitaC
KeymasterYou need to clear the browser cache.
Need help with customization or troubleshooting? Reach out to me.
October 26, 2020 at 2:57 am #501600DJ Carl
ParticipantThis reply has been marked as private. -
AuthorPosts
- The topic ‘How to center images in CSS two column for mobile’ is closed to new replies.