123

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <p>LANSING, Mich. — Sure, you could wear a campaign button. But a photo with the candidate is so much more versatile: suitable for avatars, posting with a clever hashtag, even printing out and framing if you want to go analog.</p>

<p>Posing for the camera with a presidential candidate used to be a perk generally reserved for wealthy donors. At Senator Elizabeth Warren’s events, all it costs is passing some time in a well-organized selfie* line.</p>

<svg width="100%" height="160px" viewBox="0 0 1098.72 89.55">
  <path id="curve" fill="transparent" d="M0.17,0.23c0,0,105.85,77.7,276.46,73.2s243.8-61.37,408.77-54.05c172.09,7.64,213.4,92.34,413.28,64.19"></path>
  <text width="100%" style="transform:translate3d(0,0,0);">
      <textPath style="transform:translate3d(0,0,0);" alignment-baseline="top" xlink:href="#curve" startOffset="1200px" id="text-path">*The pictures are not technically selfies.</textPath>
  </text>
</svg>

<p>At a recent event in Lansing, a small army of campaign staff members — working like a factory assembly line that hums along — helped usher voters through their encounter with Ms. Warren in eight key steps.</p>

<p>Since entering the presidential race, Ms. Warren has taken pictures with more than 38,000 people, her campaign estimates. Ms. Warren says the photos are part of her effort to build what she likes to call a “grass-roots movement.”</p>

<p>“It’s how I make this real, person to person,” she said in an interview. “I know I won’t be able to shake the hand of every single person; I know I won’t be able to take a selfie with every single human being in this country. But I’m going to try.”</p>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=PT+Serif&display=swap');

body {
  margin: 5rem 0;
  min-height: 200vh;
  font-family: 'PT Serif', serif;
}
p {
  max-width: 500px;
  margin: 0 auto 1rem;
}
text {
  fill: red;
  font-size: 30px;
}
            
          
!
            
              const textPath = document.querySelector("#text-path");

const h = document.documentElement, 
      b = document.body,
      st = 'scrollTop',
      sh = 'scrollHeight';

document.addEventListener("scroll", e => {
  let percent = (h[st]||b[st]) / ((h[sh]||b[sh]) - h.clientHeight) * 100;
  textPath.setAttribute("startOffset", (-percent * 40) + 1200)
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console