Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mjml-hero

Package Overview
Dependencies
Maintainers
6
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mjml-hero

mjml-hero

  • 4.15.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
645K
decreased by-5.89%
Maintainers
6
Weekly downloads
 
Created
Source

mj-hero

This element displays a hero image. It behaves like an mj-section with a single mj-column.

background-height and background-width attributes are mandatory.

It's best to use an image with width the same as the mj-body width (width="600px" by default). For better results, it's best to use an image with height the same or larger than the height of mj-hero.

Use background-color to provide a fallback color in case an email client doesn't support background-url.

The "height" attribute is required only for 'mode="fixed-height"'.

Fixed height

demo background picture with fixed height

<mjml>
  <mj-body>
    <mj-hero
      mode="fixed-height"
      height="469px"
      background-width="600px"
      background-height="469px"
      background-url=
          "https://cloud.githubusercontent.com/assets/1830348/15354890/1442159a-1cf0-11e6-92b1-b861dadf1750.jpg"
      background-color="#2a3448"
      padding="100px 0px">
      <mj-text
        padding="20px"
        color="#ffffff"
        font-family="Helvetica"
        align="center"
        font-size="45px"
        line-height="45px"
        font-weight="900">
        GO TO SPACE
      </mj-text>
      <mj-button href="https://mjml.io/" align="center">
        ORDER YOUR TICKET NOW
      </mj-button>
    </mj-hero>
  </mj-body>
</mjml>

try it live

Fluid height

demo background picture with fixed height

<mjml>
  <mj-body>
    <mj-hero
      mode="fluid-height"
      background-width="600px"
      background-height="469px"
      background-url=
          "https://cloud.githubusercontent.com/assets/1830348/15354890/1442159a-1cf0-11e6-92b1-b861dadf1750.jpg"
      background-color="#2a3448"
      padding="100px 0px">
      <mj-text
        padding="20px"
        color="#ffffff"
        font-family="Helvetica"
        align="center"
        font-size="45px"
        line-height="45px"
        font-weight="900">
        GO TO SPACE
      </mj-text>
      <mj-button href="https://mjml.io/" align="center">
        ORDER YOUR TICKET NOW
      </mj-button>
    </mj-hero>
  </mj-body>
</mjml>

try it live

attributeunitdescriptiondefault value
background-colorcolorhero background color#ffffff
background-heightpxheight of the image used, mandatorynone
background-positiontop/center/bottom left/center/rightbackground image positioncenter center
background-urlurlabsolute background urln/a
background-widthpxwidth of the image used, mandatoryparent element width
border-radiuspxborder radiusn/a
heightpxhero section height (required for fixed-height mode)0px
modefluid-height/fixed-heightchoose if the height is fixed based on the height attribute or fluidfluid-height
paddingpxsupports up to 4 parameters0px
padding-bottompxbottom offset0px
padding-leftpxleft offset0px
padding-rightpxright offset0px
padding-toppxtop offset0px
vertical-aligntop/middle/bottomcontent vertical alignmenttop

FAQs

Package last updated on 05 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc