Re: <div align="center"> Not working in Email Editor

Anonymous
Not applicable

<div align="center"> Not working in Email Editor

Hey there beautiful people of the Marketo Community,

Do any of you know why this bit of inline styling isn't working?

pastedImage_0.png

It seems so straight forward, but I cannot figure out what's going wrong. Any help would be very helpful.

Thanks in advanced,

Danny T.

6 REPLIES 6
Grégoire_Miche2
Level 10

Re: <div align="center"> Not working in Email Editor

I do not think align="center" is a standard HTML property of the <div> tag...

If you want to center your button, it has to be included in a larger object which value is 100% and you should rather use margin-left: auto; margin-right:auto.

-Greg

Anonymous
Not applicable

Re: <div align="center"> Not working in Email Editor

Thank you, Gregoire. I was referring to something I read on here: HTML div align Attribute . However, as you pointed out, this isn't the correct way to get the outcome I needed. I'll take your advice and see if it does the trick.

Anonymous
Not applicable

Re: <div align="center"> Not working in Email Editor

Just to add onto what Grégoire said, margin: 0 auto; does not work well on Outlook 2011&13 if I recall, they need text-align:center; on the wrapper div. You can also just make a small table to actually use the align attribute.

Grégoire_Miche2
Level 10

Re: <div align="center"> Not working in Email Editor

Yes, this is correct.

-Greg

Anonymous
Not applicable

Re: <div align="center"> Not working in Email Editor

Also, do not use W3Schools as a reference for anything. There are numerous instances of their "documentation" being misleading at best and flat out wrong at worst. I would use the MDN (Mozilla Developer Network) if you want quality documentation on HTML.

Robb_Barrett
Marketo Employee

Re: <div align="center"> Not working in Email Editor

DIVs aren't a good idea in emails. Many email clients don't accept them. You still want to use tables in emails.

Responsive Email 101: HTML & CSS Basics:

DO YOU RECOMMEND USING TABLES OR DIVS?

Email design absolutely requires using a table-based layout and structure. The reason for this is a lack of support for <div>’s by email clients, like Outlook desktop clients, as it pertains to the actual structure and foundation of the HTML. Some email clients do support <div>’s and can be extremely powerful to use for certain hacks and workarounds, especially for responsive email.

CSS available by email client:  CSS Support Guide for Email Clients | Campaign Monitor

Robb Barrett