{"title":"Adding Grid, Row, and Column Layers","id":51936,"link":"https:\/\/env.averta.net\/en\/step\/adding-grid-row-and-column-layers\/","parent":[51827],"content":"<p>In this article you can find out how to create a gird layout over a slide and locate other layers inside it. The grid itself, defines by layers and supports the layer features and parameters too.<\/p>\n<p class=\"aswi-text-box box-info\"><strong>Note: <\/strong>Since gird layers use Flex layout, this feature is not completely supported in IE9.<\/p>\n<p>To create a grid you need to use <code>grid<\/code>, <code>row<\/code> and <code>column<\/code> layer types.<\/p>\n<h2>Grid layer<\/h2>\n<p>The <code>grid<\/code> layer defines a wrapper to contains grid rows. Usually, you need to create only one gird layer. To define this layer and specify it as a layer, add <code>ms-layer<\/code> class name and set its type by <code>data-type=\"grid\"<\/code>.<\/p>\n<p>Grid layer automatically fills its height of parent element (slide). If you wish to disable this feature, you can add <code>ms-content-size<\/code> class name to its frame element i.e. <code>data-frame-class=\"ms-content-size\"<\/code><\/p>\n<p>As the grid layer element is a flex container, you can align rows inside grid by <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/align-items\" target=\"_blank\" rel=\"noopener\"><code>align-items<\/code><\/a> or <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/justify-content\" target=\"_blank\" rel=\"noopener\"><code>justify-content<\/code><\/a> styles.<\/p>\n<h2>Row layer<\/h2>\n<p>A row adds an isolated horizontal area inside the grid wrapper to contain columns. Row defines as a layer by <code>ms-layer<\/code> class name and its type sets by <code>data-type=\"row\"<\/code> attribute.<\/p>\n<p>Same as grid layer, row is a flex container too and you can align and justify its containing columns by flex box alignment style properties.p<\/p>\n<p class=\"aswi-text-box box-note\"><strong>Note: <\/strong>If you need to add flex item styles like <code>align-self<\/code> to the row element individually, the styles should add to the layer frame by <code>data-frame-style<\/code> attribute.<\/p>\n<h3>Row attributes<\/h3>\n<ul>\n<li><code>data-gutter<\/code> &#8211; Specifies the space between columns in pixels.<\/li>\n<li><code>data-widthset<\/code> &#8211; Specifies the row width size (default value is 100%).<\/li>\n<\/ul>\n<p><code>data-gutter<\/code> and <code>data-widthset<\/code> support multiple values, depends on the defined <a href=\"https:\/\/env.averta.net\/en\/step\/defining-breakpoints\/?b=51990,51990\" title=\"Defining Breakpoints\">breakpoints<\/a> in the slider. For example, you can set different gutter size for each size, <code>data-gutter=\"20,35,0\"<\/code>. The order of the values is important and it should follow the breakpoints order from large to small.<\/p>\n<h2>Column layer<\/h2>\n<p>Column is the last part of the grid layout. Columns add inside row and contain other layers. To define column, you need to specify it as a layer by adding <code>ms-layer<\/code> class name and set its type by <code>data-type=\"column\"<\/code>. Column element also supports flex box alignment styles, in other words, it aligns and justifies the layer.<\/p>\n<h3>Column width<\/h3>\n<p>Default column width is <code>100%<\/code>. To set a different width, you can use <code>data-widthset<\/code> attribute. It is the same as the row width and the attribute supports multiple values depend on the breakpoints. For example,?<code>data-widthset=\"25%,50%,100%\"<\/code> changes the column width at each breakpoint.<\/p>\n<p class=\"aswi-text-box box-note\"><strong>Note: <\/strong>If you need to add flex item styles like <code>align-self<\/code> to the column element individually, the styles should be added to the layer frame by <code>data-frame-style<\/code> attribute.<\/p>\n<h2>Example<\/h2>\n<p>The following example creates a gird containing two rows and six columns.<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;div id=\"masterslider\" class=\"master-slider\"&gt;\r\n\t\t&lt;div class=\"ms-slide\"&gt;\r\n\t\t\t&lt;div class=\"ms-layer\" data-type=\"grid\" &gt;\r\n\t\t        &lt;div class=\"ms-layer\" \r\n\t\t        \t data-type=\"row\"\r\n\t\t        \t data-widthset=\"80%,80%,100%\"\r\n\t\t        \t data-frame-style=\"align-self:center;\"\r\n\t\t        \t data-gutter=\"30,10,0\"\r\n\t\t        &gt;\r\n\t\t            &lt;div class=\"ms-layer\" data-type=\"column\" data-widthset=\"25%,50%,100%\"&gt;\r\n\t\t              &lt;div class=\"ms-layer\" data-type=\"text\" data-offset=\"absolute:false\"&gt;Text layer content&lt;\/div&gt;\r\n\t\t            &lt;\/div&gt;\r\n\t\t         \t\r\n\t\t         \t&lt;div class=\"ms-layer\" data-type=\"column\" data-widthset=\"25%,50%,100%\"&gt;\r\n\t\t              &lt;div class=\"ms-layer\" data-type=\"text\" data-offset=\"absolute:false\"&gt;Text layer content&lt;\/div&gt;\r\n\t\t            &lt;\/div&gt;\r\n\t\t            \r\n\t\t            &lt;div class=\"ms-layer\" data-type=\"column\" data-widthset=\"25%,50%,100%\"&gt;\r\n\t\t              &lt;div class=\"ms-layer\" data-type=\"text\" data-offset=\"absolute:false\"&gt;Text layer content&lt;\/div&gt;\r\n\t\t            &lt;\/div&gt;\r\n\r\n\t\t            &lt;div class=\"ms-layer\" data-type=\"column\" data-widthset=\"25%,50%,100%\"&gt;\r\n\t\t              &lt;div class=\"ms-layer\" data-type=\"text\" data-offset=\"absolute:false\"&gt;Text layer content&lt;\/div&gt;\r\n\t\t            &lt;\/div&gt; \r\n\t\t        &lt;\/div&gt;\r\n\t\t        &lt;div class=\"ms-layer\" \r\n\t\t        \t data-type=\"row\"\r\n\t\t        \t data-gutter=\"30,10,0\"\r\n\t\t        &gt;\r\n\t\t\t\t\t&lt;div class=\"ms-layer\" data-type=\"column\" data-widthset=\"50%,50%,100%\"&gt;\r\n\t\t              &lt;div class=\"ms-layer\" data-type=\"text\" data-offset=\"absolute:false\"&gt;Text layer content&lt;\/div&gt;\r\n\t\t            &lt;\/div&gt;\r\n\t\t         \t\r\n\t\t         \t&lt;div class=\"ms-layer\" data-type=\"column\" data-widthset=\"50%,50%,100%\"&gt;\r\n\t\t              &lt;div class=\"ms-layer\" data-type=\"text\" data-offset=\"absolute:false\"&gt;Text layer content&lt;\/div&gt;\r\n\t\t            &lt;\/div&gt;\r\n\t\t    \t&lt;\/div&gt;\r\n\t\t    &lt;\/div&gt;\r\n\t\t&lt;\/div&gt;\r\n\t&lt;\/div&gt;<\/pre>\n<p>Usually, you will need to disable layer absolute positioning feature inside the column layer, to let the layer get a size related to the column size. For more information check out <a href=\"https:\/\/env.averta.net\/en\/step\/positioning-layers\/?b=51939,51939\" title=\"Positioning Layers\">Positioning layers<\/a> article.<\/p>\n","type":"solution"}