# Tribute page \<img\> element should be centered within its parent element

**URL:** <https://forum.freecodecamp.org/t/tribute-page-img-element-should-be-centered-within-its-parent-element/395787>\
**Category:** General\
**Created:** [May 29, 2020, 3:13am UTC](https://forum.freecodecamp.org/t/tribute-page-img-element-should-be-centered-within-its-parent-element/395787 "2020-05-29T03:13:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vitaminar](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/vitaminar/32/150273_2.png) [@Vitaminar](https://forum.freecodecamp.org/u/Vitaminar)\
**Post date:** [May 29, 2020, 3:13am UTC](https://forum.freecodecamp.org/t/tribute-page-img-element-should-be-centered-within-its-parent-element/395787/1 "2020-05-29T03:13:09Z")

</div>

Hey! I´m trying to finish this but i got a problem with this user storie. Cna u help me out?

2. ![]() element should be centered within its parent element.

[https://codepen.io/Vitaminar/pen/NWGBKwr?editors=1100](https://codepen.io/Vitaminar/pen/NWGBKwr?editors=1100)

---

<div class="post-metadata">

**Author:** ![CaraLagumen](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/caralagumen/32/143059_2.png) [@CaraLagumen](https://forum.freecodecamp.org/u/CaraLagumen)\
**Post date:** [May 29, 2020, 5:02am UTC](https://forum.freecodecamp.org/t/tribute-page-img-element-should-be-centered-within-its-parent-element/395787/2 "2020-05-29T05:02:43Z")

</div>

Hi Vitaminar. Remove the padding on `#img-div` and add `display: block;` and `margin: auto;` to `#image`. Like so…

```auto
#img-div {
  width: auto;
  height: auto;
  max-width: 900px;
  display: block;
  text-align: center;
  object-fit: fill;
  margin: auto;
}
#image {
  width: 22vw;
  height: auto;
  display: block;
  margin: auto;
}

```

Your pen will look different but you will past the tests. I would study harder on CSS. Good luck to you!

---

<div class="post-metadata">

**Author:** ![Vitaminar](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/vitaminar/32/150273_2.png) [@Vitaminar](https://forum.freecodecamp.org/u/Vitaminar)\
**Post date:** [May 29, 2020, 12:51pm UTC](https://forum.freecodecamp.org/t/tribute-page-img-element-should-be-centered-within-its-parent-element/395787/3 "2020-05-29T12:51:07Z")

</div>

> [@CaraLagumen](#):
>
> #img-d

Thank you soo much!!You are right I will give more study to CSS.

---

<div class="post-metadata">

**Author:** ![CaraLagumen](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/caralagumen/32/143059_2.png) [@CaraLagumen](https://forum.freecodecamp.org/u/CaraLagumen)\
**Post date:** [May 29, 2020, 5:03pm UTC](https://forum.freecodecamp.org/t/tribute-page-img-element-should-be-centered-within-its-parent-element/395787/4 "2020-05-29T17:03:50Z")

</div>

No problem! Enjoy the journey. 😊

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:51pm UTC](https://forum.freecodecamp.org/t/tribute-page-img-element-should-be-centered-within-its-parent-element/395787/5 "2021-06-01T18:51:49Z")

</div>

Closed on June 1, 2021, 6:51pm UTC


