_email-base.less 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. // /**
  2. // * Copyright © Magento, Inc. All rights reserved.
  3. // * See COPYING.txt for license details.
  4. // */
  5. // The contents of this file will get split into two output files: email.less and email-inline.less.
  6. //
  7. // email.less
  8. // Styles contained in the .email-non-inline() and .media-width() mixins will be output in the email.less file
  9. // and will be included in a <style> tag in emails. Non-inline styles should be used for styles that can't be applied
  10. // as inline CSS, such as media queries.
  11. //
  12. // email-inline.less
  13. // Styles not included in the mixins mentioned above will be included in the email-inline.less file.
  14. // Since email client support for CSS in <style> tags is limited, the majority of styles should be added as "inline"
  15. // styles. CSS will be applied to transactional email HTML via the Emogrifier library, which only has support for
  16. // certain CSS selectors (source: https://github.com/jjriv/emogrifier#supported-css-selectors):
  17. //
  18. // Supported selectors (examples in parenthesis):
  19. // * ID (#logo)
  20. // * class (.logo)
  21. // * type (h1)
  22. // * descendant (.logo > a)
  23. // * child (.logo a)
  24. // * adjacent (.logo + .second-example)
  25. // * attribute presence (a[title])
  26. // * attribute value (a[title="example"])
  27. // * attribute only ([title="example"])
  28. //
  29. // Unsupported selectors (examples in parenthesis):
  30. // * first-child (div:first-child)
  31. // * last-child (div:last-child)
  32. // * nth-child (div:nth-child(3n+1))
  33. // * universal (*)
  34. // * pseudo (a:hover, a:active, a:focus, span:before, span:after, etc)
  35. //
  36. // Variables
  37. // _____________________________________________
  38. @font-size-unit-convert: false; // Prevents font-related measurements from being converted to the incompatible rem unit
  39. //
  40. // Resets
  41. // ---------------------------------------------
  42. // Generic resets
  43. body {
  44. margin: 0;
  45. padding: 0;
  46. }
  47. img {
  48. border: 0;
  49. height: auto;
  50. line-height: 100%;
  51. outline: none;
  52. text-decoration: none;
  53. }
  54. table {
  55. border-collapse: collapse;
  56. td {
  57. vertical-align: top;
  58. }
  59. }
  60. // Client-specific resets (from the Salted email template: https://github.com/rodriguezcommaj/salted)
  61. .email-non-inline() {
  62. // Prevent WebKit and Windows mobile from changing default text sizes
  63. body,
  64. table,
  65. td,
  66. a {
  67. -ms-text-size-adjust: 100%;
  68. -webkit-text-size-adjust: 100%;
  69. }
  70. // Allow smoother rendering of resized images in Internet Explorer (such as high-resolution logo)
  71. img {
  72. -ms-interpolation-mode: bicubic;
  73. }
  74. // Remove spacing between tables in Outlook 2007 and up
  75. table,
  76. td {
  77. mso-table-lspace: 0pt;
  78. mso-table-rspace: 0pt;
  79. }
  80. }
  81. //
  82. // Typography
  83. // ---------------------------------------------
  84. // See email-fonts.less for @font-face declarations
  85. .lib-typography-all();
  86. body {
  87. font-family: @font-family__base;
  88. font-weight: normal;
  89. text-align: left;
  90. }
  91. th,
  92. td {
  93. font-family: @font-family__base;
  94. }
  95. a {
  96. color: @link__color;
  97. text-decoration: @link__text-decoration;
  98. }
  99. .email-non-inline() {
  100. a:visited {
  101. color: @link__visited__color !important;
  102. text-decoration: @link__visited__text-decoration !important;
  103. }
  104. a:hover {
  105. color: @link__hover__color !important;
  106. text-decoration: @link__hover__text-decoration !important;
  107. }
  108. a:active {
  109. color: @link__active__color !important;
  110. text-decoration: @link__active__text-decoration !important;
  111. }
  112. // Remove link color on iOS
  113. .no-link a {
  114. color: @text__color !important;
  115. cursor: default !important;
  116. text-decoration: none !important;
  117. }
  118. }
  119. //
  120. // Layout
  121. // ---------------------------------------------
  122. html,
  123. body {
  124. background-color: @email__background-color;
  125. }
  126. .wrapper {
  127. margin: 0 auto;
  128. }
  129. .wrapper-inner {
  130. padding-bottom: @email-content__padding__l;
  131. width: 100%;
  132. }
  133. .main {
  134. margin: 0 auto;
  135. text-align: left; // Necessary to prevent all text from centering in Outlook 2003
  136. width: @email-body__width;
  137. }
  138. .header {
  139. padding: @email-body__padding @email-body__padding 0;
  140. }
  141. .main-content {
  142. background-color: @email-content__background-color;
  143. padding: @email-body__padding;
  144. }
  145. .footer {
  146. padding: 0 @email-body__padding @email-body__padding; // Reduce space between body of email and closing text
  147. }
  148. // Layout (Mobile)
  149. .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
  150. html,
  151. body {
  152. // Change background/foreground to same color
  153. background-color: @email-content__background-color;
  154. width: 100% !important;
  155. }
  156. .main {
  157. max-width: 100% !important;
  158. min-width: 240px;
  159. width: auto !important;
  160. }
  161. }
  162. //
  163. // Buttons
  164. // ---------------------------------------------
  165. .button {
  166. & > tr > td {
  167. padding-bottom: @indent__s;
  168. }
  169. .inner-wrapper {
  170. td {
  171. .lib-css(border-radius, @button__border-radius, 1);
  172. background-color: @button-primary__background;
  173. a {
  174. .lib-css(border-radius, @button__border-radius, 1);
  175. border: 1px solid @button-primary__background;
  176. color: @button-primary__color;
  177. display: inline-block;
  178. font-size: @button__font-size;
  179. padding: @button__padding;
  180. text-decoration: none;
  181. }
  182. }
  183. }
  184. }
  185. .email-non-inline() {
  186. .button {
  187. .inner-wrapper {
  188. td:hover {
  189. background-color: @button-primary__hover__background !important;
  190. }
  191. a:active,
  192. td:active {
  193. background-color: @button-primary__active__background !important;
  194. }
  195. }
  196. a:active,
  197. a:hover,
  198. a:visited {
  199. // Undo general link hover state
  200. border: 1px solid @button-primary__hover__background;
  201. color: @button-primary__hover__color !important;
  202. text-decoration: none !important;
  203. }
  204. }
  205. .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) {
  206. .button {
  207. .inner-wrapper {
  208. width: 100% !important;
  209. td {
  210. a {
  211. font-size: @button__font-size + 2;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. //
  219. // Messages
  220. // ---------------------------------------------
  221. .message-info,
  222. .message-gift {
  223. width: @table__width;
  224. td {
  225. background-color: @message-email__background;
  226. border: 1px solid @message-email__border-color;
  227. color: @message-email__color;
  228. margin: 0;
  229. padding: @email-content__padding__base;
  230. a {
  231. color: @message-email-link__color;
  232. }
  233. h1,
  234. h2,
  235. h3,
  236. h4,
  237. h5,
  238. h6 {
  239. margin-top: 0;
  240. }
  241. }
  242. }
  243. .message-details {
  244. margin-bottom: @indent__s;
  245. b {
  246. font-weight: bold;
  247. }
  248. td {
  249. padding-bottom: @indent__xs;
  250. b {
  251. margin-right: @indent__s;
  252. }
  253. }
  254. }