Responsive Web Design (RWD) framework

The Responsive Web Design (RWD) framework uses several technologies and design patterns to create a responsive storefront across devices.

These technologies and design patterns include the following features:

Fluid layouts and grids

The responsive storefront uses fluid layouts, where most of the page components contain percentage widths. Dynamic adjustments are enabled for the storefront layout and page elements when the screen resolution or browser window is resized.

The fluid grid system is defined in the WC_eardir/Stores.war/storedir/css/base.css file. This CSS file is the stylesheet for CSS rules common to all store pages. For more information about the files that are used in responsive starter stores, see Responsive Aurora starter store file structure.

The grid system is a CSS framework that helps build layouts by constructing a page into rows and columns. A 12-column fluid grid system with containers is used by default in the responsive storefront. This approach can then be used in customization scenarios to create consistent custom containers.

The fluid grid system with responsive features is used to build responsive layout templates and container widgets.

Example: Fluid grid

The following code snippet shows a page with a fluid grid:
		<div class="row">
			<div class="col12"></div>
		</div>
		<div class="row">
			<div class="col6"></div>
			<div class="col6"></div>
		</div>
		<div class="row">
			<div class="col4"></div>
			<div class="col4"></div>
			<div class="col4"></div>
		</div>
		<div class="row">
			<div class="col3"></div>
			<div class="col3"></div>
			<div class="col3"></div>
			<div class="col3"></div>
		</div>
		<div class="row">
			<div class="col2"></div>
			<div class="col2"></div>
			<div class="col2"></div>
			<div class="col2"></div>
			<div class="col2"></div>
			<div class="col2"></div>
		</div>
		<div class="row">
			<div class="col1"></div>
			<div class="col11"></div>
		</div>
		<div class="row">
			<div class="col2"></div>
			<div class="col10"></div>
		</div>
		<div class="row">
			<div class="col3"></div>
			<div class="col9"></div>
		</div>
		<div class="row">
			<div class="col4"></div>
			<div class="col8"></div>
		</div>
		<div class="row">
			<div class="col5"></div>
			<div class="col7"></div>
		</div>

Points to consider for rows and columns in a fluid grid system

Note the following points to consider when you are working with fluid layouts and grids:
  • A row is always divided into 12 columns, regardless of the breakpoint.
  • A row's child element can span 1 - 12 columns, regardless of the breakpoint by using one of the col* classes.
  • If a row has child elements spans a total of more than 12 column, they flow according to how HTML handles float elements.
    For example, for a row that contains three child elements that spans 8, 8 and 4 columns are as follows:
    1. The first child element is positioned at the top left of the row that spans eight columns. That is, 2/3 of the row's width.
    2. The second child element is positioned under the first child element, also spanning eight columns.
    3. The third child element is positioned to the right of the second child element, spanning four columns. That is, 1/3 of the row's width.
  • A row's child element can respond to the RWD-A and RWD-C breakpoints by using the acol* class for RWD-A or ccol* class for RWD-C.

    For example, a row's child element can span 6 columns by default and 12 columns in the RWD-A breakpoint by using class="col6 acol12".

  • Rows and their child elements must have a flexible or automatic height, as a fixed row height interferes with column that are stacked. Fixed child element heights are typically acceptable, but must be avoided since content heights can change as a row's child elements resize horizontally with the viewport.
  • The fluid grid system does not have built-in gutters, or margins, between a row's child elements. A separate set of CSS rules is used to define the margins between widgets.
  • Do not apply any margin to a row's child elements, as that causes the column width total to exceed 100%.
  • Avoid borders or padding to a row's child elements, as that requires box-sizing: border-box tagging. In addition, this rule also applies for rows. However, row margins are acceptable.
  • The col* classes contain no breakpoints. Elements with only the col* classes do not stack, regardless of the viewport width.

Column stacking

Column stacking can be enabled by specifying the column span for the RWD-A breakpoint by using the acol* classes.

Column stacking is implemented in the following way: All child elements of a row use acol12. For example, for a row that contains two child elements with the col4 acol12 classes and col8 acol12 classes respectively. In this scenario, the child elements are side-by-side by default, spanning 4 and 8 columns respectively. The acol12 class, however, makes the child elements span 12 columns each in the RWD-A breakpoint, so that they are laid out vertically, each spanning the full width of the row.
Note:
  • It is valid to have a row with child elements that span a total of more than 12 columns at certain breakpoints. The result is that they stack when the row runs out of space.
  • It is possible to merge rows to reduce HTML markup, as long as their child elements can be divided into groups that span 12 columns in total.
  • The col* classes are used instead of bcol* since it is used not only for RWD-B, but for all viewport widths, regardless of breakpoint. That is, RWD-B is used by default and the acol* and ccol* classes are used as overrides.

Column nesting

You can nest a row and its child elements within the child element of another row. This nesting causes content to overlap with other elements on store pages.

Stacking order

The stacking order controls where a sidebar element is stacked, relative to the content element.