Centering images does not work correct

hi,

i have a problem with centering images.

it works all great until the breakpoint to view in mobile (i know i have to do alot :slight_smile: ), then the centerd images are aligned to the left side.
i looked at it with googles chrome dev tools. there is the pointer: .x-iamge img { display: block ,…]
when i uncheck block it is align in the middle (centered) but i dont know where this css code came from?
any help?

thanks in advance

Hi Harald,

Thanks for reaching out.

It’s only normal to be aligned to the left, but since the image is too small then it became more noticeable when displayed on a medium device where columns collapse to one column. To fix it, globally while you prefer the existing size of the images, then please add this CSS to Theme Options > CSS

.x-image img {
display: inline;
}

This will allow it to be aligned using text-align:center;, but at the same time, disable the alignment through margins.

Thanks!

hi rad,

many thanks for your help. your code posted does work perfect!
im am curious, does this work with a class too?

class: imgmiddle
eg:

@media (max-width: 767px) {
 .imgmiddle .x-image img {
   display:inline!important;
 }
}

i tried this code but it does not work…

thanks again

Hello Harald,

Your code will only work if the custom imgmiddle class is added to the column, row or section. If you have added the class in the image element, you will use this code like this:

@media (max-width: 767px) {
 .imgmiddle.x-image img {
   display: inline!important;
 }
}

Hope this helps.

hi,

again many thanks for your help. i will try this tomorrow :slight_smile:

cheers

Sure, do let us know how it goes.

Cheers!

worked fine! thanks again!

You’re welcome. Glad we’re able to help.

Hi guys I am trying to center this music player but for some reason it is not working - can you give me a code that will help me center this?

http://wantedweb.com/newsite/music/ the first player isn’t centered.

Thanks

Hello Lucy,

To avoid any confusion, I request you to please create new ticket as this ticket has been started by a different user. Posting on the same creates lot of confusion which slows down the response time.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.