2-Column Layout: Media Queries
Master responsive HTML email with media queries
Core Skills You'll Master
Nested Table Structure
Learn to create complex email layouts using properly nested HTML tables that work across all email clients.
Desktop & Mobile Styling
Write CSS that adapts seamlessly between desktop two-column and mobile single-column layouts.
Media Query Implementation
Implement responsive design techniques specifically optimized for email client compatibility.
This exercise focuses on creating a 2-column newsletter layout that transforms into a 1-column mobile layout using media queries. The modular table approach ensures consistent spacing across email clients.
Initial Setup Process
Open Project Files
Navigate to your Desktop and access the Class Files folder, then open the 2-Column Layout directory in your code editor.
Create Outer Table
Copy the prepared table code snippet and paste it into the HTML body with proper attributes including border, cellpadding, and cellspacing.
Set Fixed Width
Update the table width to 680 pixels to ensure consistent display across different email clients.
Always use a valid placeholder URL like example.com instead of empty href attributes. Empty hrefs can cause display issues in email clients like Outlook.com.
Banner Implementation Checklist
Use the prepared content file to save development time
Essential for accessibility and email client compatibility
Makes the entire banner clickable for better user experience
Verify the banner displays correctly before proceeding
Using discrete tables for each content section provides consistent spacing across email clients and makes weekly newsletter updates much easier to manage.
Table Structure Approaches
| Feature | Single Table | Nested Tables |
|---|---|---|
| Complexity | Simple | Moderate |
| Control | Limited | Precise |
| Client Support | Basic | Excellent |
| Maintenance | Difficult | Easy |
Base CSS Implementation
Remove Image Gaps
Set images to display block to eliminate unwanted spacing that appears below banner images in email clients.
Prevent Link Borders
Add border zero to images to prevent ugly blue borders that some email clients add to linked images.
Style Main Heading
Apply color, font-family, font-size, and remove default margins for consistent header appearance.
Add Content Padding
Create a mainContent class with 20px padding to provide proper spacing around text content.
Mobile Breakpoint Strategy
Place media queries after regular CSS rules within the style tag. This creates a clear separation between desktop and mobile styles for easier maintenance.
When email CSS is inlined, it gains high specificity that media queries cannot override. Adding important declarations ensures mobile styles can still take precedence.
Using Important Declarations
Key Takeaways

