# Why is my css width and height not working

**URL:** <https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514>\
**Category:** Curriculum Help\
**Tags:** css, html\
**Created:** [December 17, 2022, 4:14am UTC](https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514 "2022-12-17T04:14:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![codethematrix1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codethematrix1/32/253183_2.png) [@codethematrix1](https://forum.freecodecamp.org/u/codethematrix1)\
**Post date:** [December 17, 2022, 4:14am UTC](https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514/1 "2022-12-17T04:14:03Z")

</div>

In CSS I set an image so its width and height are a certain thing so my image does not go under my text but it does not work even with the `!important `thing.

Go here and click on woodcutting then inspect [https://gem-hunt.netlify.app/play.html](https://gem-hunt.netlify.app/play.html)

---

<div class="post-metadata">

**Author:** ![codethematrix1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codethematrix1/32/253183_2.png) [@codethematrix1](https://forum.freecodecamp.org/u/codethematrix1)\
**Post date:** [December 17, 2022, 2:22pm UTC](https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514/3 "2022-12-17T14:22:33Z")

</div>

The tree should not be like acting as a background and go “behind/under” the tree should move down so the text won’t be ontop of it. As shown.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/6/a/7/6a7ed5e3a6278504cd949f9a6976f20c5ec97eed.jpeg)

---

<div class="post-metadata">

**Author:** ![codethematrix1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codethematrix1/32/253183_2.png) [@codethematrix1](https://forum.freecodecamp.org/u/codethematrix1)\
**Post date:** [December 17, 2022, 2:54pm UTC](https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514/5 "2022-12-17T14:54:21Z")

</div>

I wanted to mimic something like this will it?

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/e/c/2/ec2121e773992b6eee6bf2ad2436786872e03f48.png)

---

<div class="post-metadata">

**Author:** ![codethematrix1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codethematrix1/32/253183_2.png) [@codethematrix1](https://forum.freecodecamp.org/u/codethematrix1)\
**Post date:** [December 17, 2022, 8:50pm UTC](https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514/7 "2022-12-17T20:50:06Z")

</div>

I applied it It looks still the same and I have no experience in flex.

---

<div class="post-metadata">

**Author:** ![codethematrix1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codethematrix1/32/253183_2.png) [@codethematrix1](https://forum.freecodecamp.org/u/codethematrix1)\
**Post date:** [December 17, 2022, 9:56pm UTC](https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514/9 "2022-12-17T21:56:35Z")

</div>

fixed! Now I can do the centering I don’t need your help anymore. All I did was add the flexbox and removed the position absolute.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/4/2/8/428bd28b15adfb8948eddcc7e3509a5325b19bd2.jpeg)

---

<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:** [June 18, 2023, 9:56am UTC](https://forum.freecodecamp.org/t/why-is-my-css-width-and-height-not-working/578514/10 "2023-06-18T09:56:36Z")

</div>

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