css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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>Stacked Text Experiments</h1>

<p>This is an experiment to reproduce a simplistic CSS Ruby Layout with flexbox. CSS Ruby Layout has inconsistent support across modern browsers and many browsers lack any support for complex CSS Ruby Layout. <a href="https://www.w3.org/TR/css-ruby-1/">https://www.w3.org/TR/css-ruby-1/</a><p>
  
<p>My specific goal with this pattern is for languages learns and one who wish to phonetize complex scripts in a way which ties each word to its source.</p>

<!-- 
u
-->

<h2>Arabic/English Example</h2>

<p class="stackedTextContainer" dir="rtl" lang="ar" xml:lang="ar">
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">Malachi</span>
    <span class="vernacularText">
‏ملاخي</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">Mal-a-khey</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">1:10</span>
    <span class="vernacularText">١٠:١</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">wahad:ashra</span>
  </span>  
</p>
<p class="stackedTextContainer" dir="rtl" lang="ar" xml:lang="ar">
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">who</span>
    <span class="vernacularText">وَمَنْ</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">Wa-man</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">from</span>
    <span class="vernacularText">مِنْكُمْ</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">min-Kum</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">lock</span>
    <span class="vernacularText">يُغْلِقُ</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">yaghliq</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">gates</span>
    <span class="vernacularText">ٱلْأَبْوَابَ</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">al'abwab</span>
  </span> 
   <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">free</span>
    <span class="vernacularText">مَجَّانًا؟‏</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">maj-janan?</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">in fact</span>
    <span class="vernacularText">بَلْ</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">Bal</span>
  </span> 
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">not</span>
    <span class="vernacularText">لَا</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">la</span>
  </span> 
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">ignite</span>
    <span class="vernacularText">تُوقِدُونَ</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">two-qi-duna</span>
  </span> 
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">on</span>
    <span class="vernacularText">عَلَى</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">3-la</span>
  </span>   
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">altar (slaughterhouse)</span>
    <span class="vernacularText">مَذْبَحِي</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">mad(th)bahi</span>
  </span>  
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">without</span>
    <span class="vernacularText">بِلَا</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">bil-la</span>
  </span>  
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">price</span>
    <span class="vernacularText">ثَمَنٍ.</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">tha-man.</span>
  </span>    
</p>

<h2>Korean/English Example</h2>

<p class="stackedTextContainer" dir="ltr" lang="ko" xml:lang="ko">
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">Hello!</span>
    <span class="vernacularText">안녕하세요!</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">an-nyung-ha-se-yo!</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">to the zoo</span>
    <span class="vernacularText">동물원에</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">dong-mool-won-eh</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">together</span>
    <span class="vernacularText">같이</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">gat-chi</span>
  </span>
  <span class="stackedText">
    <span class="translatedText" dir="ltr" lang="en" xml:lang="en">shall (we) go?</span>
    <span class="vernacularText">갈까요?</span>
    <span class="phoneticText" dir="ltr" lang="en" xml:lang="en">gal-gga-yo?</span>
  </span>
</p>



            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Harmattan|Noto+Sans');

html {
  font-size: 1.2em;
  font-family: 'Noto Sans', sans-serif;
  margin: 0 30px;
}

[lang="ar"] .vernacularText {
  font-family: 'Harmattan', sans-serif;
  font-size: 1.25rem;
}

* { box-sizing: border-box; }

.stackedTextContainer {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px dotted #ccc;
  &:first-of-type {
    border: none;
  }
}

.stackedText {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0.5rem;
  > span {
    min-height: 1rem;
  }
}

.translatedText {
  font-size: .5rem;
  color: #ccc;
}

.vernacularText {
  line-height: 1.5;
}

.phoneticText {
  color: firebrick;
}
            
          
!
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.
Loading ..................

Console