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.

            
              <h1>Accessible Drop Caps Breaks with Long Descenders.</h1>
<p>See <a href="https://adrianroselli.com/2019/10/accessible-drop-caps.html#comment-176899" rel="noopener noreferrer">Adrian Roselli, Accessible Drop Caps.</a>

<div>
  <div>

    <h2>Incorrect</h2>
    <p>
      <span aria-labelledby="word--first" role="text">
        <span aria-hidden="true">
         <span class="dropcap">Q</span>uoth
        </span>
        <span id="word--first" class="hidden">Quoth</span>
      </span>
      the raven &ldquo;Nevermore.&rdquo; Matthew watched the storm, so beautiful yet terrific. Mist enveloped the ship three hours out from port. Waves flung themselves at the blue evening.
    </p>
    <h3>Incorrect with Class for Descenders</h3>
         <span aria-labelledby="word--first" role="text">
        <span aria-hidden="true">
         <span class="dropcap descender">J</span>oke&rsquo;s
        </span>
        <span id="word--first" class="hidden">Joke's</span>
      </span> on you! Silver mist suffused the deck of the ship. I watched the storm, so beautiful yet terrific. Lorem ipsum dolor sit amet, consectetur
      adipiscing elit. Nulla pellentesque elit justo, nec rutrum leo pulvinar vel.
    </p>
  </div>
  <div>

    <h2>Not Incorrect</h2>
    <p>
      <span aria-hidden="true" class="drop">
        <span>Q</span>uoth
      </span>
      <span class="visually-hidden">Quoth</span> the raven &ldquo;Nevermore.&rdquo; Matthew watched the storm, so beautiful yet terrific. Mist enveloped the ship three hours out from port. Waves flung themselves at the blue evening. 
    </p>
    <h3>Not Incorrect with Class for Descenders</h3>
    <p><span aria-hidden="true" class="drop">
        <span class="descender">J</span>oke&rsquo;s
      </span>
      <span class="visually-hidden">Jokes</span> on you! Silver mist suffused the deck of the ship. I watched the storm, so beautiful yet terrific. Lorem ipsum dolor sit amet, consectetur
      adipiscing elit. Nulla pellentesque elit justo, nec rutrum leo pulvinar vel.
    </p>

  </div>

  <div>

    <h2>Standard CSS</h2>
    <p class ="drop">
      Quoth the raven &ldquo;Nevermore.&rdquo; Matthew watched the storm, so beautiful yet terrific. Mist enveloped the ship three hours out from port. Waves flung themselves at the blue evening. </p>
    <h3>Standard CSS with Class for Descenders</h3>
    <p class="drop descender">Joke&rsquo;s on you! Silver mist suffused the deck of the ship. I watched the storm, so beautiful yet terrific. Lorem ipsum dolor sit amet, consectetur
      adipiscing elit. Nulla pellentesque elit justo, nec rutrum leo pulvinar vel.
    </p>
  </div>
</div>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Playfair+Display&display=swap');

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.4;
  color: #333;
  background-color: #eee;
}

body > div {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

body > div div {
  flex: 0 1 15em;
  margin: 0 1em;
}


/* Styles from another demo */
.dropcap {
  font-family: "Playfair Display", serif;
  font-size: 5.5rem;
  float: left;
  line-height: 1;
  margin-right: 0.05em;
/*   outline: 1px solid #f00; */
  &.descender {
  margin-bottom: .2em;
  }
}

.dropcap:before,
.dropcap:after {
  content: "";
  display: block;
}
.dropcap:before {
/*   margin-bottom: -0.175em; */
  margin-bottom: -0.21em;
}
.dropcap:after {
  margin-top: -0.05em;
}


/* The revised pattern */
/* Selector to enforce the pattern */
p > span[aria-hidden=true].drop span {
  font-family: "Playfair Display", serif;
  font-size: 5.5rem;
  float: left;
  line-height: 1;
  margin-right: 0.05em;
/*   outline: 1px solid #f00; */
  &.descender {
    margin-bottom: .2em;
  }
}

p > span[aria-hidden=true].drop span::before,
p > span[aria-hidden=true].drop span::after {
  content: "";
  display: block;
}

p > span[aria-hidden=true].drop span::before {
/*   margin-bottom: -0.175em; */
  margin-bottom: -0.21em;
}

p > span[aria-hidden=true].drop span::after {
  margin-top: -0.05em;
}

.visually-hidden, .hidden {
  position: absolute;
  top: auto;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  white-space: nowrap;
}

p.drop:first-letter { // Uses a class. I'm not being a brat. "Q" & "J" need margin-bottom or they'll creep into the 4th text line.
  font-family: "Playfair Display", serif;
  font-size: 5.5rem;
  float: left;
  line-height: .6; /* from 1 */
  margin-right: 0.05em;
}

p.descender:first-letter { // Additional class to account for the descender on "Q" & "J".
    margin-bottom: .2em;
  }


            
          
!
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