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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <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>
              
            
!

CSS

              
                @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;
  }


              
            
!

JS

              
                
              
            
!
999px

Console