# Need help centering image

**URL:** <https://forum.freecodecamp.org/t/need-help-centering-image/463303>\
**Category:** Curriculum Help\
**Tags:** css, html\
**Created:** [June 3, 2021, 6:12pm UTC](https://forum.freecodecamp.org/t/need-help-centering-image/463303 "2021-06-03T18:12:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomiwa-01](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tomiwa-01/32/220194_2.png) [@Tomiwa-01](https://forum.freecodecamp.org/u/Tomiwa-01)\
**Post date:** [June 3, 2021, 6:12pm UTC](https://forum.freecodecamp.org/t/need-help-centering-image/463303/1 "2021-06-03T18:12:40Z")

</div>

**Hello I’m a beginner:**  
I need help positioning the image to center.  
Any help please?

**Your code so far**

[https://codepen.io/tomiwa-01/full/BaWrzBK](https://codepen.io/tomiwa-01/full/BaWrzBK)

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37`

**Challenge:** Build a Tribute Page

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/2022/responsive-web-design/build-a-tribute-page-project/build-a-tribute-page)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![MatchaCrisp](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/matchacrisp/32/193162_2.png) [@MatchaCrisp](https://forum.freecodecamp.org/u/MatchaCrisp)\
**Post date:** [June 3, 2021, 6:27pm UTC](https://forum.freecodecamp.org/t/need-help-centering-image/463303/2 "2021-06-03T18:27:16Z")

</div>

Hi, check out this relevant challenge from responsive web design:

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/responsive-web-design/applied-visual-design/center-an-element-horizontally-using-the-margin-property)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [June 3, 2021, 7:41pm UTC](https://forum.freecodecamp.org/t/need-help-centering-image/463303/3 "2021-06-03T19:41:40Z")

</div>

Hi @Tomiwa-01 !

Welcome to the forum!

I edited your post to remove the link from the title.  
Please avoid placing links in the title since we cannot click on them.

You will also need to add the test suite to your html.

```auto
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

```

You are currently passing 3/10 tests.

---

<div class="post-metadata">

**Author:** ![KellyR](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kellyr/32/227330_2.png) [@KellyR](https://forum.freecodecamp.org/u/KellyR)\
**Post date:** [June 4, 2021, 2:41pm UTC](https://forum.freecodecamp.org/t/need-help-centering-image/463303/4 "2021-06-04T14:41:55Z")

</div>

Hi Tomiwa. I am also a beginner and had this problem. Try adding the following to your css:  
margin: auto;  
display: block;

---

<div class="post-metadata">

**Author:** ![Edgar29](https://avatars.discourse-cdn.com/v4/letter/e/6a8cbe/32.png) [@Edgar29](https://forum.freecodecamp.org/u/Edgar29)\
**Post date:** [June 4, 2021, 5:41pm UTC](https://forum.freecodecamp.org/t/need-help-centering-image/463303/5 "2021-06-04T17:41:15Z")

</div>

img {  
display: block;  
margin: 0 auto;  
}

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [December 4, 2021, 5:41am UTC](https://forum.freecodecamp.org/t/need-help-centering-image/463303/6 "2021-12-04T05:41:53Z")

</div>

Closed on December 4, 2021, 5:41am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
