_email-base.less 7.07 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
// /**
//  * Copyright © Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//  The contents of this file will get split into two output files: email.less and email-inline.less.
//
//  email.less
//  Styles contained in the .email-non-inline() and .media-width() mixins will be output in the email.less file
//  and will be included in a <style> tag in emails. Non-inline styles should be used for styles that can't be applied
//  as inline CSS, such as media queries.
//
//  email-inline.less
//  Styles not included in the mixins mentioned above will be included in the email-inline.less file.
//  Since email client support for CSS in <style> tags is limited, the majority of styles should be added as "inline"
//  styles. CSS will be applied to transactional email HTML via the Emogrifier library, which only has support for
//  certain CSS selectors (source: https://github.com/jjriv/emogrifier#supported-css-selectors):
//
//  Supported selectors (examples in parenthesis):
//      * ID (#logo)
//      * class (.logo)
//      * type (h1)
//      * descendant (.logo > a)
//      * child (.logo a)
//      * adjacent (.logo + .second-example)
//      * attribute presence (a[title])
//      * attribute value (a[title="example"])
//      * attribute only ([title="example"])
//
//  Unsupported selectors (examples in parenthesis):
//      * first-child (div:first-child)
//      * last-child (div:last-child)
//      * nth-child (div:nth-child(3n+1))
//      * universal (*)
//      * pseudo (a:hover, a:active, a:focus, span:before, span:after, etc)

//
//  Variables
//  _____________________________________________

@font-size-unit-convert: false; // Prevents font-related measurements from being converted to the incompatible rem unit

//
//  Resets
//  ---------------------------------------------

//  Generic resets

body {
    margin: 0;
    padding: 0;
}

img {
    border: 0;
    height: auto;
    line-height: 100%;
    outline: none;
    text-decoration: none;
}

table {
    border-collapse: collapse;

    td {
        vertical-align: top;
    }
}

//  Client-specific resets (from the Salted email template: https://github.com/rodriguezcommaj/salted)

.email-non-inline() {
    //  Prevent WebKit and Windows mobile from changing default text sizes
    body,
    table,
    td,
    a {
        -ms-text-size-adjust: 100%;
        -webkit-text-size-adjust: 100%;
    }

    //  Allow smoother rendering of resized images in Internet Explorer (such as high-resolution logo)
    img {
        -ms-interpolation-mode: bicubic;
    }

    //  Remove spacing between tables in Outlook 2007 and up
    table,
    td {
        mso-table-lspace: 0pt;
        mso-table-rspace: 0pt;
    }
}

//
//  Typography
//  ---------------------------------------------

//  See email-fonts.less for @font-face declarations

.lib-typography-all();

body {
    font-family: @font-family__base;
    font-weight: normal;
    text-align: left;
}

th,
td {
    font-family: @font-family__base;
}

a {
    color: @link__color;
    text-decoration: @link__text-decoration;
}

.email-non-inline() {
    a:visited {
        color: @link__visited__color !important;
        text-decoration: @link__visited__text-decoration !important;
    }

    a:hover {
        color: @link__hover__color !important;
        text-decoration: @link__hover__text-decoration !important;
    }

    a:active {
        color: @link__active__color !important;
        text-decoration: @link__active__text-decoration !important;
    }

    //  Remove link color on iOS
    .no-link a {
        color: @text__color !important;
        cursor: default !important;
        text-decoration: none !important;
    }
}

//
//  Layout
//  ---------------------------------------------

html,
body {
    background-color: @email__background-color;
}

.wrapper {
    margin: 0 auto;
}

.wrapper-inner {
    padding-bottom: @email-content__padding__l;
    width: 100%;
}

.main {
    margin: 0 auto;
    text-align: left; // Necessary to prevent all text from centering in Outlook 2003
    width: @email-body__width;
}

.header {
    padding: @email-body__padding @email-body__padding 0;
}

.main-content {
    background-color: @email-content__background-color;
    padding: @email-body__padding;
}

.footer {
    padding: 0 @email-body__padding @email-body__padding; // Reduce space between body of email and closing text
}

//  Layout (Mobile)
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    html,
    body {
        //  Change background/foreground to same color
        background-color: @email-content__background-color;
        width: 100% !important;
    }

    .main {
        max-width: 100% !important;
        min-width: 240px;
        width: auto !important;
    }
}

//
//  Buttons
//  ---------------------------------------------

.button {
    & > tr > td {
        padding-bottom: @indent__s;
    }

    .inner-wrapper {
        td {
            .lib-css(border-radius, @button__border-radius, 1);
            background-color: @button-primary__background;

            a {
                .lib-css(border-radius, @button__border-radius, 1);
                border: 1px solid @button-primary__background;
                color: @button-primary__color;
                display: inline-block;
                font-size: @button__font-size;
                padding: @button__padding;
                text-decoration: none;
            }
        }
    }
}

.email-non-inline() {
    .button {
        .inner-wrapper {
            td:hover {
                background-color: @button-primary__hover__background !important;
            }

            a:active,
            td:active {
                background-color: @button-primary__active__background !important;
            }
        }

        a:active,
        a:hover,
        a:visited {
            //  Undo general link hover state
            border: 1px solid @button-primary__hover__background;
            color: @button-primary__hover__color !important;
            text-decoration: none !important;
        }
    }

    .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) {
        .button {
            .inner-wrapper {
                width: 100% !important;

                td {
                    a {
                        font-size: @button__font-size + 2;
                    }
                }
            }
        }
    }
}

//
//  Messages
//  ---------------------------------------------

.message-info,
.message-gift {
    width: @table__width;

    td {
        background-color: @message-email__background;
        border: 1px solid @message-email__border-color;
        color: @message-email__color;
        margin: 0;
        padding: @email-content__padding__base;

        a {
            color: @message-email-link__color;
        }

        h1,
        h2,
        h3,
        h4,
        h5,
        h6 {
            margin-top: 0;
        }
    }
}

.message-details {
    margin-bottom: @indent__s;

    b {
        font-weight: bold;
    }

    td {
        padding-bottom: @indent__xs;

        b {
            margin-right: @indent__s;
        }
    }
}