web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Text Alignment keeps going centered

(0) ShareShare
ReportReport
Posted on by 2

In my MS Dynamics email templates, I noticed that anything that comes after the last style block in the main css in the header, the text will all be centered in the email. Here's that style block:

[data-layout="true"] {
margin: 0 auto;
max-width: /* @layout-max-width */
640px/* @layout-max-width */
;
}
To avoid that, I've had to make other style sheets or put styles before that block. Is anyone else experiencing the same? 
Sometimes, we're also seeing the text get centered even with our precautions. 
I have the same question (0)
  • alemieux69 Profile Picture
    2 on at

    In further investigation, it looks like Dynamics is favoring <th> instead of <td> in tables. That could be the issue too.

  • Daniel Norris Profile Picture
    43 on at

    Yes margin:0 auto; centers. Have you tried going to the text element and adding text-align:left; or float:left or something similar?

  • alemieux69 Profile Picture
    2 on at

    Yes, we've had to resort to that. But what is the purpose of the [data-layout] style and why is it centering text?

  • Daniel Norris Profile Picture
    43 on at

    Without looking too deeply, I believe its a way of structuring the template and enabling drop and drag functionality. Sometimes this can cause interference with goals.

  • Suggested answer
    Jelena Rajkovic Profile Picture
    Microsoft Employee on at

    Hello.

    The style you mentioned is used to center the email.

    The width is set using general styles and it's meant to be centered when received. This is by design and just set the style on element with attribute data-layout="true".

    But, this shouldn't break anything and the text should be left aligned by default:
    Screenshot-2023_2D00_03_2D00_20-094530.png 

    This is because we add styles that are not visible in HTML tab, but they are in the final email.

    The first div element in the body has attribute data-layout-version="v2" :

    <div data-layout="true" data-layout-version="v2" style="margin: auto; max-width: 600px;">

    And we have style for text that's added for text alignment:
            th.columnContainer,
            th.inner {
                font-weight: 400;
                text-align: left
            }
    This style is visible in Preview tab, you can inspect and see the final HTML that has all the processing there.
    This is used so any style update or any fixes needed can be added without editing email from HTML tab.
    Regarding table elements, there were issues with some mobile email clients when using td elements, so that's why we use th elements instead. It shouldn't create any issues.

    I'm  not able to reproduce this issue, so if you could share and example code, I can try to see what's the issue and provide more information regarding this.
    Did you maybe remove this attribute? Or maybe started with custom code? If you have repro steps for this issue, that would be helpful.
    Thank you,
    Jelena





  • RP-03020926-0 Profile Picture
    2 on at
    Hello,
     
    We are currently using Real-time journeys on Dynamics and we are having this exact same issue. While we can change the html on the template and successfully style on <div data-layout="true" data-layout-version="v2"to margin: 0; thus ensuring left alignment, once the email is sent this gets automatically reverted.
     
    It happens once we use the Template on an actual Email, the style is replaced automatically by margin: auto or on some email clients after sending. This makes it really complex to achieve left alignment as the preview displays the email correctly.
     
    Is there any workaround to disable this type of post processing on a specific email/template, I am assuming it might be related with a feature to keep the email responsive and compatible with different email clients.
     
    Thanks,
    Ricardo Pires

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Nagaraju_Matta Profile Picture

Nagaraju_Matta 123

#2
Hamza H Profile Picture

Hamza H 96 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 66 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans