-
philipperoussel
-
Fernando
Hi Philippe,
What I would recommend is to install the GeneareteBlocks plugin and use that to add the Image within a Container so that you’d have options for its alignment.
Reference:
https://docs.generateblocks.com/article/image-overview/
https://docs.generateblocks.com/article/layout-options-overview/
https://docs.generateblocks.com/article/flexbox-alignment-matrix/Otherwise, you can add this CSS through Appearance > Customize > Additional CSS:
aside#custom_html-30 .textwidget.custom-html-widget { display: flex; justify-content: center; }
-
philipperoussel
Hi Fernando,
I should have better clarified that my issue is purely an html one since the image must be in a custom html widget (not an image widget since the image will not be centered there either).
-
Hi there,
you should be able to simply set the text-align of the widget like so:
.custom-html-widget { text-align: center; }
-
philipperoussel
Hi David,
It works. I presume that for an image widget, it would be:
.image-widget {
text-align: center;
}Right?
-
Off the top of my head, I could not say… I would need to inspect the widgets HTML for the class.
If you want to add an image widget to the site, I can take a look. -
philipperoussel
I tried the following:
.image-html-widget {
text-align: center;
}and
.image-widget {
text-align: center;
}Neither of these works. No big deal but it would be nice to be able to center an image in an image widget.
-
Can we see this image on your site?
-
philipperoussel
It’s the last widget in the right-hand column (an image widget).
-
Fernando
Hi there,
Try this instead:
aside.widget_media_image { display: flex; justify-content: center; }
-
philipperoussel
Cool!
-
Fernando
Glad that worked!
-
philipperoussel
Hi,
The code given earlier works for PCs but not for mobile devices.
Thanks for your help again,
Philippe
-
Hi there
can you try clearing the browser caches on your mobile ?
-
philipperoussel
Hi David,
I did that on two different smartphones. It does not change anything.
-
Are you going to centre everything in the sidebar?
If so ; this CSS should suffice:.sidebar .widget { text-align: center; }
- You must be logged in to reply to this topic.