Skip to main content

Notifications

Announcements

No record found.

Customer Insights - Journeys forum
Suggested answer

Text Alignment keeps going centered

Posted on by 89

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. 
Categories:
  • Suggested answer
    RE: Text Alignment keeps going centered

    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





  • Daniel Norris Profile Picture
    Daniel Norris 20 on at
    RE: Text Alignment keeps going centered

    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.

  • alemieux69 Profile Picture
    alemieux69 89 on at
    RE: Text Alignment keeps going centered

    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
    Daniel Norris 20 on at
    RE: Text Alignment keeps going centered

    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
    alemieux69 89 on at
    RE: Text Alignment keeps going centered

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

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,353 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans