Skip to content

Move general mail styles to inline for fully compatible mail client #37589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 15 commits into
base: 2.4-develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/code/Magento/Email/view/frontend/email/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">
{{css file="css/email-non-inline.css"}}
{{var template_styles|raw}}

Copy link
Contributor Author

@mrtuvn mrtuvn Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add template_styles at lasts for css specificity

{{css file="css/email.css"}}
</style>
</head>
<body>
{{inlinecss file="css/email.css"}}
{{inlinecss file="css/email-inline.css"}}

<!-- Begin wrapper table -->
<table class="wrapper" width="100%">
<tr>
Expand Down
12 changes: 12 additions & 0 deletions app/design/frontend/Magento/blank/web/css/email-non-inline.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/


//
// Non-inline styles
// ---------------------------------------------

// Include all styles that have been indicated as non-inline styles
.email-non-inline();
6 changes: 0 additions & 6 deletions app/design/frontend/Magento/blank/web/css/email.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,3 @@
// It is impossible to apply media queries as inline styles, so all media queries must be output in this file
@media-target: 'all';

//
// Non-inline styles
// ---------------------------------------------

// Include all styles that have been indicated as non-inline styles
.email-non-inline();