# Debugging your CSS in CodePen

**URL:** <https://forum.freecodecamp.org/t/debugging-your-css-in-codepen/159368>\
**Category:** General\
**Created:** [November 16, 2017, 11:41am UTC](https://forum.freecodecamp.org/t/debugging-your-css-in-codepen/159368 "2017-11-16T11:41:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfiquet](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sfiquet/32/67130_2.png) [@sfiquet](https://forum.freecodecamp.org/u/sfiquet)\
**Post date:** [November 16, 2017, 11:41am UTC](https://forum.freecodecamp.org/t/debugging-your-css-in-codepen/159368/1 "2017-11-16T11:41:08Z")

</div>

When designing a responsive user interface, it is easier to start with the mobile version and, once you’re happy with it, add media queries to deal with bigger screens.

I use Chrome’s dev tools and its mobile emulation mode for this. It’s wonderful: You can see your page displayed as you would on the selected phone (Mostly. It’s not perfect.) and you have all the HTML and CSS on the side of the screen. You can edit the CSS and see what happens. It’s great for learning and fine-tuning.

I’ve tried to do that with CodePen and have been going increasingly frustrated. The Debug page would work fine in desktop mode but everything would be way too small in mobile mode. On the other hand, the Full Page View works fine with the mobile mode, but then you have to dig into CodePen’s HTML until you can actually see your own code, buried deep into an `iframe`. It gets old fast.

After some digging it turns out that Full Page works fine because CodePen’s `<head>` has the `viewport` meta set up, and Debug doesn’t work because CodePen doesn’t bother to set it up for you. It does set up the `charset` but not the `viewport`.

How do you solve this? Click on the little gear next to HTML and paste the following line into “Stuff for \<head\>”:

`<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">`

That’s all. It works. No more digging into CodePen’s code. You can now fine-tune your mobile version in peace.

---

<div class="post-metadata">

**Author:** ![ArielLeslie](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/arielleslie/32/264841_2.png) [@ArielLeslie](https://forum.freecodecamp.org/u/ArielLeslie)\
**Post date:** [November 16, 2017, 3:32pm UTC](https://forum.freecodecamp.org/t/debugging-your-css-in-codepen/159368/2 "2017-11-16T15:32:14Z")

</div>

Excellent advice. Thanks for sharing.

---

<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:** [January 16, 2021, 6:00pm UTC](https://forum.freecodecamp.org/t/debugging-your-css-in-codepen/159368/3 "2021-01-16T18:00:32Z")

</div>

Closed on January 16, 2021, 6:00pm UTC


