In anticipation for the switch to the new drag and drop email editor I am creating a custom module for emails that consists of a background, an image field and a rich text field. In writting the HTML for the module and nothing I have tried has been able to center the image. I've tried quite a few things...
Creating a class attribute to center align
Using auto left & right margins in the style of the image (by itself and in cobination with #3)
Using justfy and align properties to style the <div> block (by itself and in cobination with #2)
Here's what I got currently:
Module Code
And how that appears in the email:
Appears in Email
Note: as you can see no option to edit the image alignment when selected or in the left-side window.
Before anyone says it, HubSpot does not seem to allow you to add images through the rich text fields using the new email editor. I tried that route already. They also don't seem to give the option to center the image in the email edit functions anymore either...
My theory is that there is something in the image field snippet that is overriding my desire for center alignment because when I try to load the image it centers for .25 of a second. Any suggestion on what the issue may be, what I can try next to fix it or a workaround?
I put the image field & rich text field in table cells stacked on top of eachother with the cell background formatted for our brand color. Then I sandwhiched them between a top slant image and a bottom slant image in cells above and below. I tested it out using the client test in the email preview and it showed up for all of the clients our demographic uses.
Always open for improvements is anyone has an idea. 😊
@Abirch Email is stuck in the 90s, tables are your friend. If you put your image in a table and add align="center" to your table cell it should center the image. I'd suggest writing the entire module in tables though as using just divs tends to never work very well cross-client. Will also note that clip-path isn't supported in most email clients.
I had not thought of using a table to help me with my formatting troubles. I ran with your suggestions a bit and was able to further improve my module so that my slanted sections shows for all email clients. 🤓
I put the image field & rich text field in table cells stacked on top of eachother with the cell background formatted for our brand color. Then I sandwhiched them between a top slant image and a bottom slant image in cells above and below. I tested it out using the client test in the email preview and it showed up for all of the clients our demographic uses.
Always open for improvements is anyone has an idea. 😊