# I need help making my code reaponsive to devices

**URL:** <https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983>\
**Category:** Curriculum Help\
**Tags:** css, html\
**Created:** [July 13, 2019, 10:57pm UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983 "2019-07-13T22:57:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tkay95](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@Tkay95](https://forum.freecodecamp.org/u/Tkay95)\
**Post date:** [July 13, 2019, 10:57pm UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/1 "2019-07-13T22:57:12Z")

</div>

i finished my tribute page but im having trouble . Its not responsive to devices. Could some take a look at my code and assist me?  
[https://codepen.io/Takudzwa95/live/GbeLvB](https://codepen.io/Takudzwa95/live/GbeLvB)

---

<div class="post-metadata">

**Author:** ![Steffan153](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/steffan153/32/119621_2.png) [@Steffan153](https://forum.freecodecamp.org/u/Steffan153)\
**Post date:** [July 13, 2019, 11:01pm UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/2 "2019-07-13T23:01:38Z")

</div>

To help you test, see this for testing on mobile:

> [@Restaurant-Survey Form](http://forum.freecodecamp.org/t/restaurant-survey-form/280754/18):
>
> Here’s a short vid I made on testing a pen on mobile (no real phone required, this only simulates it):

---

<div class="post-metadata">

**Author:** ![guardians\_folly](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/guardians_folly/32/121750_2.png) [@guardians\_folly](https://forum.freecodecamp.org/u/guardians_folly)\
**Post date:** [July 13, 2019, 11:44pm UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/3 "2019-07-13T23:44:30Z")

</div>

A good way to test the responsiveness of an app is via f12 or developer tools. However it’s not straightforward in codepen. I would download something like sublime text or vs code, create an html file with relevant CS file, open up file in browser and troubleshoot via f12

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [July 14, 2019, 2:21am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/4 "2019-07-14T02:21:09Z")

</div>

You can just change `width` to `max-width` on `#main` and `#tribute-info`. Maybe give the `#tribute-info` a bit of padding as well.

1. `<img-caption>` is not a valid element, what you want is [`<figcaption>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption). I’d also center the caption text.

2. I would add a [nicer font](https://fonts.google.com) and increase the font size.

3. On line: 74 you have a typo (line-heigt \> line-height).

---

<div class="post-metadata">

**Author:** ![NEo47443707](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/neo47443707/32/118109_2.png) [@NEo47443707](https://forum.freecodecamp.org/u/NEo47443707)\
**Post date:** [July 14, 2019, 2:59am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/5 "2019-07-14T02:59:13Z")

</div>

use relative units on the `width` and `height` properties of the `main` element, like so:

```auto
height: 100%;
width: 80%;

```

---

<div class="post-metadata">

**Author:** ![Tkay95](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@Tkay95](https://forum.freecodecamp.org/u/Tkay95)\
**Post date:** [July 14, 2019, 9:02am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/6 "2019-07-14T09:02:46Z")

</div>

max-width:100%? Also thank you very much 🙏🏽

---

<div class="post-metadata">

**Author:** ![Tkay95](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@Tkay95](https://forum.freecodecamp.org/u/Tkay95)\
**Post date:** [July 14, 2019, 9:03am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/7 "2019-07-14T09:03:36Z")

</div>

Thank you! Very helpful!

---

<div class="post-metadata">

**Author:** ![Tkay95](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@Tkay95](https://forum.freecodecamp.org/u/Tkay95)\
**Post date:** [July 14, 2019, 9:04am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/8 "2019-07-14T09:04:04Z")

</div>

Thank you very much!

---

<div class="post-metadata">

**Author:** ![Tkay95](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@Tkay95](https://forum.freecodecamp.org/u/Tkay95)\
**Post date:** [July 14, 2019, 9:04am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/9 "2019-07-14T09:04:22Z")

</div>

Thank you for your assistance

---

<div class="post-metadata">

**Author:** ![NEo47443707](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/neo47443707/32/118109_2.png) [@NEo47443707](https://forum.freecodecamp.org/u/NEo47443707)\
**Post date:** [July 14, 2019, 7:58pm UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/10 "2019-07-14T19:58:28Z")

</div>

max-width works too, glad I was able to help.

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [July 15, 2019, 12:59am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/11 "2019-07-15T00:59:22Z")

</div>

You can literally just replace the two widths you have with max-width and it will work just fine still using the `px` values you have.

That is one of the benefits of using max-width, you can set the value using a fixed unit like `px` and it will still let the element shrink smaller, but limit its maximum width.

Setting widths in percentages can sometimes get a little wonky. Another option is using the `vw` unit.

---

<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:** [March 9, 2021, 11:31am UTC](https://forum.freecodecamp.org/t/i-need-help-making-my-code-reaponsive-to-devices/294983/12 "2021-03-09T11:31:04Z")

</div>

Closed on March 9, 2021, 11:31am UTC


