Search code examples
html-emailmjml

Is it possible to set a container or wrapper width with mjml?


I'm using mjml to create HTML emails, and it looks like the default container width is set to 600px. I need this to be wider, is it possible to either override the 600px default, or setup a wrapper or container div where I can adjust the width?


Solution

  • According to their documentation, you can add the width attribute:

    width="400"
    

    I ran a test in their editor and it seemed to work - https://mjml.io/try-it-live

    <mjml>
      <mj-body width="400">
        <mj-section>
          <mj-column>
            <mj-text>This is a header</mj-text>
          </mj-column>
        </mj-section>
        <mj-section background-color="#e7e7e7">
          <mj-column>
            <mj-social>
              <mj-social-element name="facebook" />
            </mj-social>
          </mj-column>
        </mj-section>
      </mj-body>
    </mjml>