Navigation Menu+

Columns Design

How to set the order of stacked columns in a responsive email design

Exterior Hardscape

Got two or more columns of content in your responsive email design, but find them stacking in the wrong order when viewed on mobile devices? This simple coding technique will put them in their place.

When coding emails, there are likely times when you wish you had a little more control. For example, when creating layouts with the intent of stacking multiple columns (or technically, table cells) for easy reading on mobile displays, the natural order when using % column widths is left on top of right. But, how about if you wanted an image in a right-hand side column to stack on top of some text in a left-hand column? The answer is something quite unlikely – the dir attribute.

Quite simply, dir allows you to change the ordering of any HTML elements, although its original purpose is to adjust content for right-to-left text (as you likely know, the browser default in places that use Romanized text is left-to-right). It’s also supported in every email client that we know of.

Here’s the natural order when using % column widths:

By applying dir=”rtl” to a table (thus changing the order in which nested cells stack) and dir=”ltr” to the cells within (to ensure the text reads left-to-right instead of, well, backwards), you can reverse the browser/email client defaults and reliably stack content when it’s viewed on small viewports. Here’s the simplified code:

/* Media query for mobile*/
@media only screen and (max-width: 480px) {
.full {
display:block;
width:100%;
}
}

/* HTML */


Right-hand side content: Stacks on top on mobile

Left-hand side content: Stacks underneath on mobile

Applying dir=rtl when using % column widths

To help you see the difference, compare:

And that’s a wrap. Huge thanks go to Brett DeWoody for documenting this technique and providing a solid starting point for our own example. If you’d like to read more about creating responsive layouts that fare well in (almost) every email client, I recommend checking out Creating a centered, responsive design without media queries. With an understanding of these techniques, you can take control of your content flow on any device.



Possini Euro Design Possini Euro Design Deco Style Walnut Column Floor Lamp
Lighting (Possini Euro Design)
  • Walnut wood finish.
  • Beige linen shade.
  • From Possini Euro Design®.
  • Takes three 60 watt bulbs (not included).
  • On-off foot switch.
Possini Euro Design Possini Euro Design Deco Style Walnut Column Floor Lamp
Lighting (Possini Euro Design)
  • Walnut wood finish.
  • Beige linen shade.
  • From Possini Euro Design®.
  • Takes three 60 watt bulbs (not included).
  • On-off foot switch.
KOHLER KOHLER K-72760-CP Artifacts Bathroom sink spout with Column design, Less Handles, Polished Chrome
Home Improvement (KOHLER)
  • Includes stationary spout with aerator and pop-up drain with 1-1/4-inch tailpiece
  • Handles sold separately
  • Laminar flow delivers a graceful stream while conserving water
  • 1.5 gpm (gallons per minute) flow rate
  • Coordinate with your choice of Artifacts handles for a personalized design
Design Toscano Design Toscano Column of the Maenads Pedestal Sculpture
Lawn & Patio (Design Toscano)
  • Dimensions: 11 Wx11 Dx29 H 19 lbs.
  • Hand-cast using real crushed stone bonded with high quality designer resin
  • Each piece is individually hand-finished by our artisans
  • Exclusive to the Design Toscano brand and perfect for your home or garden
Builders Websource® BeamChek 2016 - NEW! - Wood, Steel, Beam & Column Structural Design Software - Windows 10, Windows 8, Windows 7, Vista
Software (Builders Websource®)
  • BeamChek 2016 Latest Edition - Thousands sold - Easy to use
  • Size beams, columns, girders, hips, valleys, headers, joists, and rafters
  • Wood, steel, timber, glulams, LVL, engineered lumber, flitch beams
  • Conforms to latest National Design Specification (NDS® 2015 and earlier)
  • Ideal for architects, engineers, building inspectors, lumberyards, plan-check officials, structural forensics



Related Posts