Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- Read the full post at https://jen4web.substack.com/p/units -->

<h1>Challenge for Units</h1>

<h2>INSTRUCTIONS:</h2>
<p><em>Details are in the CSS</em></p>
<ol>
  <li>Fork this CodePen</li>
  <li>Adjust the container to use percentages</li>
  <li>Adjust the padding, margin or line-height using ems, then change these to rem and see if you can spot the difference</li>
  <li>Bonus: use the design principle of proximity to make the text more readable and 'designed'</li>
</ol>

<p><strong>Curious about the poem's markup?</strong> Revisit #30DaysOfHTML, specifically:</p>
<ul>
  <li><a href="https://jen4web.substack.com/p/units-discussion" target="_blank">Day 2: Blockquote and q</a></li>
  <li><a href="https://jen4web.substack.com/p/cite" target="_blank">Day 3: Cite</a></li>
  <li><a href="https://jen4web.substack.com/p/figure" target="_blank">Day 26: figure and figcaption</a></li>
</ul>

<p><a href="https://jen4web.substack.com/p/units-discussion" target="_blank" class="button">Share your answer on Substack</a></p>

<hr><!-- Mess with anything below this line or in the CSS column! -->

<div class="container">
  <h1>Shel Silverstein</h1>
  <p>Shel Silverstein was a unique writer with many artistic talents. While generally best known for his poetry and literature for children, he was also a cartoonist, composer, lyricist, and folksinger.</p>
  <h2>About this poem</h2>
  <p>Boa Constrictor is a poem out of Shel Silverstein’s popular children’s book, Where the Sidewalk Ends. Shel Silverstein is known for his humorous poems, and the black and white sketch drawings that accompany them. Silverstein’s poems always rhyme, and usually only last one or two pages. Silverstein’s illustrations are what make the poem. They are subtle, but effective.</p>
  <figure>
    <blockquote>
      <h3>'I'm being eaten by a boa constrictor'</h3>
      <p>
        Oh, I'm being eaten<br>
        By a boa constrictor,<br>
        A boa constrictor,<br>
        A boa constrictor,<br>
        I'm being eaten by a boa constrictor,<br>
        And I don't like it--one bit.
      </p>
      <p>
        Well, what do you know?<br>
        It's nibblin' my toe.
      </p>
      <p>
        Oh, gee,<br>
        It's up to my knee.
      </p>
      <p>
        Oh my,<br>
        It's up to my thigh.
      </p>
      <p>
        Oh, fiddle,<br>
        It's up to my middle.
      </p>
      <p>
        Oh, heck,<br>
        It's up to my neck.
      </p>
      <p>
        Oh, dread,<br>
        It's upmmmmmmmmmmffffffffff . . .
      </p>
    </blockquote>
    <figcaption>
      <cite><a href="https://i.pinimg.com/originals/cc/2d/75/cc2d75c1d5238bed42bcf671a6064b3b.jpg">I'm being eaten by a boa constrictor</a></cite>, Shel Silverstein, 'Where the Sidewalk Ends' (1974)
    </figcaption>
  </figure>

              
            
!

CSS

              
                /* Keep in mind that our goal today is to practice with units such as %, em, rem today and how they interact -- not to show you how to layout a website, because this ain't it */

/* (1) Adjust the container to be a percentage of the page to be something less than 100%. */

/* (2) Adjust the margin, padding or line-height (or all of these if you want to) for any text elements using em -- then use the inspector in your web developer tools (included in Firefox and Chrome, right-click "inspect") to view how much padding was added. 

ACCESSING DEVTOOLS INSIDE OF CODEPEN:
a. Make sure the CodePen is forked and saved to your account or this won't work!

b. Look in the bottom bar, right grouping of buttons. You'll see an icon with a square with an arrow, just to the left of "delete". Click this and your pen's display will open in a new window.

c. NOW use devtools to see what's happening to your code!

d. Once you close the display window, if it looks like your display in CodePen has "disappeared", pull on the dividers with your mouse to bring the window back. Usually that's either pulling on the right side of the window or the bottom of the window.

*/

/* (3) Change all your em to rem -- notice what happens -- use the inspector to help you see the difference */

/* rem is based on the default font size for text in the document (in this case 16px) -- so adding 1.0 rem of padding will mean adding 16px of space, no matter the font-size of the element */

/* em is based on the font size of each element, adding 1.0 em of padding will mean adding whatever font-size the original element is in space -- it's relative to the font-size of the element. Adding 1.0em of padding to the top of a 36px headline means adding 36px of space to the top of the headline */

/* (4) Bonus: ideally when working with a lot of text, we want headlines to be more closely associated with the content underneath them, rather than the content above. Erika's web students learn this as the design concept "proximity" meaning we should attempt to visual associate content with like content to make our page content look designed. When you squint your eyes at the text after adjusting for proximity, you should be able to see each headline and associated text as a distinct block. */

/* If you're up for the challenge, adjust the margin or padding so that headlines are much closer to the content underneath and much farther from the content above. Try using rem for this. */

/* Erika usually starts with about half the standard margin under a headline and 1.5x a the margin above, then adjusts based on the specific type / size of type in question. Good luck! */













/* default styling for the page / instructions - you don't need to touch this unless you really want to */
body {
  font-family: Arial, sans-serif;
  line-height: 1.2rem;
  padding-bottom: 5.0em;
}
blockquote {
  font-family: Georgia, serif;
}
.button {
  background-color: #eb3b5a;
  padding: 0.5rem 1rem;
  border: 1px solid #eb3b5a;
  border-radius: 30px;
  color: white;
  text-decoration: none;
  font-weight: bold;
  display: inline-block;
  margin: 1em 0 5rem;
}
.button:hover {
  color: #eb3b5a;
  background-color: white;
}
              
            
!

JS

              
                /* 

💯 This challenge is certified 90% free of JavaScript. 

ALL THE GOOD STUFF IS IN THE HTML AND CSS BLOCKS :-D

*/
              
            
!
999px

Console