Before You Develop

Before you develop the AEM application that supports your web pages, several design decisions should be made. For example, you need to have the following information:

  • The devices you are targeting
  • The target viewport sizes
  • The page layouts for each of the targeted viewport size

Application Structure

The typical AEM application structure supports all responsive design implementations:

  • Page components reside below /apps/<application_name>/components
  • Templates reside below /apps/<application_name>/templates

Using Media Queries

Media queries enable the selective use of CSS styles for page rendering. AEM development tools and features enable you to effectively and efficiently implement media queries in your applications.

The W3C group provides the Media Queries recommendation that describes this CSS3 feature and the syntax.

Creating the CSS File

In your CSS file, define media queries based on the properties of the devices that you are targeting. The following implementation strategy is effective for managing styles for each media query:

  • Use a Client Library folder to define the CSS that is assembled when the page is rendered.
  • Define each media query and the associated styles in separate CSS files. It is useful to use file names that represent the device features of the media query.
  • Define styles that are common to all devices in a separate CSS file.
  • In the css.txt file of the Client Library folder, order the list CSS files as is required in the assembled CSS file.

The WKND tutorial uses this strategy to define styles in the site design. The CSS file used by WKND is located at /apps/wknd/clientlibs/clientlib-grid/less/grid.less.