# Adding display: flex to a wrapper div

**URL:** <https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708>\
**Category:** CMS Development\
**Created:** [January 11, 2017, 7:20pm UTC](https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708 "2017-01-11T19:20:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![asacurry](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/asacurry/32/68963_2.png) [@asacurry](https://community.hubspot.com/u/asacurry)\
**Post date:** [January 11, 2017, 7:20pm UTC](https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708/1 "2017-01-11T19:20:18Z")

</div>

Hello,

I’m trying to vertically center an image in a responsive div using flexbox. I can assign display:flex to the group in the template editor, but upon inspecting the preview it looks like it needs to be applied to a .row-fluid that is wrapped around the images.

Is there a way to apply the flex attribute to the immediate parent (which I can’t seem to access using the layout editor), or have the .row-fluid div inherit it from a class applied to the module group?

---

<div class="post-metadata">

**Author:** ![relabidin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/relabidin/32/10664_2.png) [@relabidin](https://community.hubspot.com/u/relabidin)\
**Post date:** [January 11, 2017, 9:49pm UTC](https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708/2 "2017-01-11T21:49:14Z")

</div>

Hi @asacurry,

This is a great question that goes a bit over my head.

@ndwilliams3 and @stefen are our resident design experts. Would you mind taking a quick look here?

Rami

---

<div class="post-metadata">

**Author:** ![stefen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stefen/32/29274_2.png) [@stefen](https://community.hubspot.com/u/stefen)\
**Post date:** [January 11, 2017, 9:52pm UTC](https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708/3 "2017-01-11T21:52:06Z")

</div>

Give your module group a custom class. Then in your stylesheet you can use the class as a way to pinpoint that row-fluid class like so:

```auto
.my-custom-class > .row-fluid-wrapper > .row-fluid {
 display: flex;
 align-items: center;
}

```

---

<div class="post-metadata">

**Author:** ![ndwilliams3](https://avatars.discourse-cdn.com/v4/letter/n/c4cdca/32.png) [@ndwilliams3](https://community.hubspot.com/u/ndwilliams3)\
**Post date:** [January 11, 2017, 9:58pm UTC](https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708/4 "2017-01-11T21:58:29Z")

</div>

I agree with @stefen. That would be the best approach.

---

<div class="post-metadata">

**Author:** ![asacurry](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/asacurry/32/68963_2.png) [@asacurry](https://community.hubspot.com/u/asacurry)\
**Post date:** [January 11, 2017, 10:11pm UTC](https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708/5 "2017-01-11T22:11:03Z")

</div>

exactly what I needed, was missing the “\>”…

Many thanks!

---

<div class="post-metadata">

**Author:** ![Stevie-Kv](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevie-kv/32/97206_2.png) [@Stevie-Kv](https://community.hubspot.com/u/Stevie-Kv)\
**Post date:** [October 16, 2018, 1:17pm UTC](https://community.hubspot.com/t/adding-display-flex-to-a-wrapper-div/708/6 "2018-10-16T13:17:26Z")

</div>

Hi Stefan

Thanks for the answer, I’ve been looking into this for quite some time.

What had confused me is that I thought \> was used left to right. Parent element \> Child element, your answer seems to go the opposite direction child \> parent/child \> parent
