How to specify the number of columns on a page through a layout file

You can specify the the number of columns on a page through a layout XML file: using the layout attribute of the page tag.

XSD shema

Examples

Look at the examples from the core.

The default Magento 2 page layout has 3 columns:

The default frontend product view page layout has a single column:

The default frontend customer account page layout has two columns: a wide right and a tiny (sidebar) left:

How are the standard layout types defined

They are defined ion the layouts.xml files.

Frontend layout types

Backend layout types

The common (both for the frontend and the backend) layout types

How to define a new layout type?

See the examples in the core’s unit tests:
https://github.com/magento/magento2/blob/2.0.0/lib/internal/Magento/Framework/View/Test/Unit/PageLayout/_files/layouts_one.xml#L8-L12

The official documentation

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/layout-types.html

1 Like

See also:

A post was split to a new topic: How to set “the 2columns-right” layout for the for product pages?