October 2017
Intermediate to advanced
370 pages
8h 57m
English
The layout attribute in AMP gives the developer a very powerful, per-element tool for declaring how elements should be displayed on the page. It offers a convenient way to implement common layout patterns that would otherwise require complex CSS to build. This makes the layout attribute extremely useful, especially considering AMP's 50 KB CSS limitation.
The layout attribute can be applied to any AMP element (but not regular HTML elements), and can take the following values:
| Value | Behavior |
| container | Element size is defined by its children, like an HTML div |
| fill | Element takes up all available space |
| fixed | Element has fixed width and height, and both must be specified |
| fixed-height | Element takes all available space, ... |
Read now
Unlock full access