# CSS Grid Layout

**URL:** <https://community.plotly.com/t/css-grid-layout/8431>\
**Category:** Dash Python\
**Created:** [February 19, 2018, 2:47am UTC](https://community.plotly.com/t/css-grid-layout/8431 "2018-02-19T02:47:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![freshwuzhere](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@freshwuzhere](https://community.plotly.com/u/freshwuzhere)\
**Post date:** [February 19, 2018, 2:47am UTC](https://community.plotly.com/t/css-grid-layout/8431/1 "2018-02-19T02:47:34Z")

</div>

I notice that the css stored at [[https://codepen.io/chriddyp/pen/bWLwgP.css](https://codepen.io/chriddyp/pen/bWLwgP.css)] relies upon a skeleton style gird layout. I have been trying implement a classic display:grid layout with only partial success.

Is this type of css display supported?

Ian

---

<div class="post-metadata">

**Author:** ![nedned](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/nedned/32/8795_2.png) [@nedned](https://community.plotly.com/u/nedned)\
**Post date:** [February 19, 2018, 4:33pm UTC](https://community.plotly.com/t/css-grid-layout/8431/2 "2018-02-19T16:33:41Z")

</div>

Dash apps result in regular HTML elements that can be styled however you want. So for the most part, if you can do it with HTML/CSS, you can achieve it within Dash.

---

<div class="post-metadata">

**Author:** ![freshwuzhere](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@freshwuzhere](https://community.plotly.com/u/freshwuzhere)\
**Post date:** [February 24, 2018, 12:15am UTC](https://community.plotly.com/t/css-grid-layout/8431/3 "2018-02-24T00:15:23Z")

</div>

Hi @nedned ,

I attach a Dash example and a codepen example which give different outputs.  
It looks like the display:grid format does not respect the grid tracks or span properly.

**Dash Code**

import dash  
import dash\_html\_components as html

app = dash.Dash()

app.layout = html.Div(  
className = ‘wrapper’,  
children=[  
html.Div(html.H1(  
className=‘header-left’,  
children=‘LEFT’  
),),  
html.Div(html.H2(  
className=‘header-middle’,  
children =‘MIDDLE’,  
),),  
html.Div(html.H1(  
className = ‘header-right’,  
children = ‘RIGHT’  
),),  
],  
)

app.css.append\_css({  
‘external\_url’: ‘[http://127.0.0.1:8000/test-css.css](http://127.0.0.1:8000/test-css.css)’}) # locally served css file

if **name** == ‘ **main** ’:  
app.run\_server(debug=True)

 ![Dash%20rendering](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/e/e6a4c8b403633a6840309e1b473600d26fda934d.png)

**test-css.css**  
.wrapper {  
display: grid;  
grid-template-columns: 20vw 12vw 32vw 32vw;  
grid-template-rows: 12% 7% 58% 7%;  
grid-gap: 4px;  
border: 2px dashed rgba(114, 186, 94, 0.35);  
}  
.header-left {  
grid-column: 1/3;  
grid-row: 1/2;  
border: 2px dashed rgba(114, 186, 94, 0.35);  
text-align: left;  
}  
.header-middle {  
grid-column: 3/4;  
grid-row: 1/2;  
border: 2px dashed rgba(114, 186, 94, 0.35);  
text-align:center;  
}  
.header-right {  
grid-column: 4/5;  
grid-row: 1/2;  
border: 2px dashed rgba(114, 186, 94, 0.35);  
justify-content: end;  
text-align:right;  
}

**[codepen.io](http://codepen.io)**

# LEFT

# MID

# RIGHT

 ![Codepen](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/9/90034205f43f34de28aeeb77b9bb7f7494b6f945.png)

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [February 24, 2018, 12:24am UTC](https://community.plotly.com/t/css-grid-layout/8431/4 "2018-02-24T00:24:08Z")

</div>

> [@freshwuzhere](#):
>
> I attach a Dash example and a codepen example which give different outputs.

Dash doesn’t intercept CSS or HTML at all. I recommend using your browser’s devtools and inspecting the HTML elements one by one to see what the differences between the versions are. Look at the rendered markup and at the inherited CSS properties.
