基于Zurb库的邮件模板在Firefox移动端布局异常求助
Hey there, let’s get this email table sorted out for Firefox mobile! The issue you’re seeing—where the "TOTAL" header gets pushed to a new row—usually boils down to a mix of Zurb Foundation class inconsistencies and Firefox’s strict handling of table layouts on mobile. Here’s how to fix it step by step:
1. Fix Class Name Inconsistencies
First, I spotted a typo in your column classes: the first <td> uses column (singular) instead of columns (plural). Zurb Foundation for Emails relies on the plural columns class to trigger its responsive grid behavior. Using the singular will break the grid calculation in Firefox, leading to misaligned columns.
2. Standardize Table Base Attributes
Add width="100%" and cellspacing="0" to your <table> tag. These attributes ensure the table fills its container and removes default spacing that can throw off responsive layouts in mobile browsers—Firefox is particularly picky about this.
3. Resolve Alignment & Content Overflow
- Replace inline
alignattributes with Zurb’s built-in text alignment classes (liketext-center/text-right) to avoid conflicts between HTML attributes and CSS styling. - Add
word-break: break-wordto your.descclass to prevent long text from pushing column widths beyond their defined grid sizes, which was likely forcing the "TOTAL" header onto a new line.
Modified Code Example
<table class="row" width="100%" cellspacing="0"> <tbody> <tr> <td class="small-5 large-7 columns"> <p class="heading-text">ITEM</p> </td> <td class="small-3 large-2 columns space text-center"> <p class="heading-text">QTY</p> </td> <td class="small-4 large-3 columns space text-right"> <p class="heading-text">TOTAL</p> </td> </tr> <tr> <td class="small-5 large-7 columns space"> <h6>1613 | <span class="memo-text">Out</span></h6> <p class="desc" style="word-break: break-word;">The framework includes two typographic scalesone uses a narrow range of sizes.</p> </td> <td class="small-2 large-2 columns space text-center"> <h6>15.00</h6> </td> <td class="small-5 large-3 columns space text-right"> <h6>$394,567.00</h6> <p class="desc">10.00%</p> <p class="desc">$39,800.00</p> </td> </tr> </tbody> </table>
Why This Works
- The corrected
columnsclass ensures Zurb’s grid system properly calculates column widths across breakpoints, including Firefox mobile. width="100%"andcellspacing="0"eliminate unexpected spacing and ensure the table adapts to the mobile viewport without overflow.word-break: break-wordprevents long descriptions from forcing columns to expand beyond their allocated space, which was the main culprit behind the "TOTAL" header being pushed down.- Using Zurb’s text alignment classes instead of inline
alignattributes keeps styling consistent and avoids rendering conflicts in Firefox.
内容的提问来源于stack exchange,提问作者Nisha Patel

