Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                
<main>
<section>
  <h1>Semantics and Typography</h1>
  <h2>An Introduction </h2>
  <p>This little baseline has ( almost) all of the content flow and phrasing elements. It attempts to use all of those elements according to their defined semantics. It also tries to provide a baseline style for those elements. So this isn't a normalize
    or a reset, but maybe the first set of styles you'd add before you start branding stuff. Here is the <a href="https://www.w3.org/TR/html5/">full list of the elements</a>.
  </p>
  
  <p>There's also a <a href="https://codepen.io/paceaux/pen/mdmBPPx">Form Baseline</a> and a <a href="https://codepen.io/paceaux/pen/KKWwyMa">Table baseline</a> if that's more of your thing. </p>
</section>
<section>
  <h1>Here is a collection of headings </h1>
  <h2>The subheading that should tell you more about it</h2>
  <h3>The heading that (probably) explains sections of content</h3>
  <h4>The First unimportant heading</h4>
  <h5>The Second Unimportant heading</h5>
  <h6>The Heading for pedants</h6>
</section>
<hr />
  <h3>Paragraphs and Styles</h3>
  <h4>Text Level Semantics</h4>
  <p>I'm that paragraph with some <em>emphasis on the text-level semantics</em> where I might feel the need to <strong>share some strong opinions</strong>. This paragraph even uses elements that should have been deprecated, but instead the W3C redefined
    them. And that's dumb, because formerly presentational elements now do silly things like call a thing to your <b>attention</b> for no good reason, or tell you that something is <u>mispelled</u>, or the name of a boat &mdash; which makes as much
    sense as building another <i>Titanic</i>. It makes no sense, but &hellip; <i>c'est la vie</i>. </p>

  <h4>Editing semantics</h4>
  <p>This paragraph is all about editing my opinions. Sometimes I have opinions <s> that are no longer relevant</s>. Sometimes I <mark>mark or highlight</mark> some text so that people notice it. <ins>Sometimes I insert some thoughts later</ins>. Sometimes
    I <del>delete those thoughts</del>. The user can also select text, so it's important to be sure that the user can discern whether I've highlighted something, or they have. </p>

  <h4>Definitions</h4>
  <p> The whole point of this paragraph is meaning. Sometimes we need an explanation, or a <dfn title="Definition">definition </dfn>. For those times, you have an element that you can use to tell the user that one word in this paragraph is the term that the
    paragraph is actually explaining. </p>

  <p>Sometimes, we have to define an abbreviation. Take, <dfn><abbr title="Light Amplification by Stimulated Emition of Radiation">LASER</abbr></dfn>, which is an acronym for Light Amplification by Stimulated Emition of Radiation. The abbreviation tags don't
    make much sense unless they have a title, though. </p>

  <p> You know what time it is? No, not Howdy-Doody time. It's <time>April 29, 2016</time>.

  </p>

  <hr />
  <h3>Quoting, Citing, scripting</h3>
  <p>You know how you're saying something, and then you just feel the need to make quick quote, like <q>Hey, I totally want to buy Somnaderpaphil LG for my herpes</q>? But after some reading,you see that small print that says <small>  it can give 1 out of 2 users irritable bowel syndrome</small>.
    Then you read all of scientific things <sub>(1/0)</sub> or citations <sup>1</sup> that make you feel better. </p>

  <blockquote>Go, Blockquote. Quote away. Be the blockquote you've always wanted to be. But within reason. Also, don't forget who made you...
    <cite>The Dude who spoke you into existence</cite>
  </blockquote>

  <hr />
  <h3>Code Semantics</h3>
  <p> Writing code is hard. You have stuff like variables. Imagine <var> n</var> is a variable. <wbr /> Maybe you have some code, like <code> n = 1</code>. Now you want to increment it with your <kbd>+</kbd> on the keyboard, so the result is a sample (e.g.<samp>n == 2</samp>    ). And maybe there's <data value="one,two,three">data</data>, where maybe the browser needs an internal value, but the user needs to see something friendly.
  </p>

  <pre>
&lt;p&gt; Writing code is hard. You have stuff like variables. Imagine where &lt;var&gt; n&lt;/var&gt; is a variable.<wbr /> &lt;br /&gt; Maybe you have some code, like &lt;code&gt; n = 1&lt;/code&gt;. Now you want to increment <wbr />it with your &lt;kbd&gt;+&lt;/kbd&gt; on the keyboard, so the result is a sample (e.g.&lt;samp&gt; n == 2&lt;/samp&gt;).
&lt;/p&gt;
</pre>
  <hr />
  <h3>List semantics </h3>
  <ol>
    <li>The first item in an ordered list</li>
    <li>The second item in an ordered list</li>
  </ol>
  <ul>
    <li>I am a humble list item, I don't care if I'm first</li>
    <li>I am a second humble list item, put me wherever yo!</li>
  </ul>

  <menu>
    <li><a href="https://github.com/paceaux/typography-baseline" target="_blank" rel="noopener">See the Typography Baseline</a></li>
    <li><a href="https://github.com/paceaux/form-baseline" target="_blank" rel="noopener">Look at the Form Baseline</a></li>
    <li><a href="https://github.com/paceaux/table-baseline" target="_blank" rel="noopener">Review the Table Baseline</a></li>
  </menu>

  <dl>
    <dt>ordered list</dt>
    <dd>a list with numbers, where the items need to be in a particular order </dd>
    <dt>unordered list</dt>
    <dd>a list with bullets or some other indicator, where the items can be in any order</dd>
    <dt>menu</dt>
    <dd>An unordered list with interactive items or commands that the user can use. </dd>
    <dt>definition list</dt>
    <dd>The forgotten list. It has definition terms,<code>&lt;dt&gt;</code> and definitions <code>&lt;dd&gt;</code>. It's pretty much perfect for listing out the kinds of lists in a subtle, 4th wall-breaking kind of way. </dd>

  </dl>
  <hr />
  <h3>Language Semantics</h3>
  <p>Then there's that text where you need to show it in a different language. Like, say you want to know my name, but you speak Korean better than English. Well, I'd tell you my name is <ruby lang="en" >Frank <rt lang="ko">퍼랜케</rt></ruby> and I hope you'd know how to pronounce it. </p>

  <p>Sometimes, though, you need to show something in a semitic language. Maybe you want to say <ruby>Shalom <rt lang="he"><bdi> שלום</bdi></rt></ruby><ruby> in the home<rt lang="he"><bdi>בבית</bdi></rt></ruby>.That's totally fine, just remember that text runs in the opposite direction in Arabic, Farsi, and Hebrew. </p>

  <p>With Semitic Languages, though, you need to flip the order of some things. Say you're reading some text like, <bdi>אני אוהב את יין</bdi> and it translates as <samp><bdo dir="rtl"><bdi>I</bdi> <bdi>like</bdi> <bdi>wine</bdi></bdo></samp>. You have to remember that there's an element for saying a block of text is written in reverse, and another for saying a span of text should be the reverse of its parent. </p>

  <p>Another way to understand that text is to look at the word-for-word translation: <ruby><rbc><rb>Shalom</rb><rb> in the home</rb></rbc><rtc lang="he"><rt><bdi>שלום</bdi></rt><rt><bdi>בבית</bdi></rt></rtc></ruby></p>

  <hr />
</section>
</main>
<footer>
  <h2>Who should you contact about this?</h2>
  <address>
    <p>Frank M. Taylor (aka <a href="https://twitter.com/paceaux" target="_blank" rel="noopener">@paceaux</a>)</p>
  </address>
</footer>
              
            
!

CSS

              
                :root {
/*===== 
    #Color #Palette #Variables
    Variables follow convention found here: https://codepen.io/paceaux/pen/XdxQza
    Color is a very dark gray:  rgb (31, 31, 31). Grays are multiples of 31. 
    The NeutralDarker gray passes WCAGAA for contrast against a light background
=====*/
    --colorNeutralDarker: rgb(31, 31, 31);              /* #1f1f1f; hsl(0%, 0%, 12%) */
    --colorNeutralDark: rgb(62, 62, 62);                /* #5d5d5d; hsl(0, 0%, 36%) */
    --colorNeutral: rgb(155, 155, 155);                 /* #9b9b9b; hsl(0, 0%, 61%) */
    --colorNeutralLight: rgb(186, 186, 186);            /* #bababa; hsl(0, 0%, 73%) */
    --colorNeutralLighter: rgb(217, 217, 217);          /* #d9d9d9; hsl(0, 0%, 85%) */

    /*
     These colors pass WCAG 2.1 for contrast against a light background and the NeutralDarker gray
     Before you change them, check your contrast ratios:  https://webaim.org/resources/linkcontrastchecker/
    */
    --colorCool: rgb(47, 120, 193);                          /*   #2f78c1; hsl(210, 61%, 47%);  */
    --colorCoolDarker: rgb(41, 105, 168);                    /*  #2a6bac;  hsl(210, 61%, 41%) */

/*===== 
    #Color #Link #Border #Variables
    Variables follow convention found here: https://gist.github.com/paceaux/8638765e747f5bd6387b721cde99e066#sassscssstylus-naming
=====*/
    --baseTextColor: var(--colorNeutralDarker);
    --baseEditorialTextColor: var(--colorNeutralDark);
    --baseLinkColor: var(--colorCool);
    --baseLinkColorHover: var(--colorCoolDarker);
    --baseInlineBorderColor: var(--colorNeutralLight);

    --baseTextLineColor: var(--baseTextColor);
    --alertTextLineColor: rgb(255, 0, 0);

    --baseQuoteBackgroundColor: 155, 155, 155, ; /* Same as colorNeutral*/

/*===== 
    #LineHeight #Variables
=====*/
    --baseLineHeight: 1.618;
    --smallLineHeight: 1.2;

/*===== 
    #Body #Size #Paragraph #content-flow #Variables
=====*/
    --biggestTextSize:  1.3em;
    --biggerTextSize: 1.2em;
    --bigTextSize: 1.1em;
    --baseTextSize: 1em;
    --smallTextSize: .8em;
    --smallerTextSize: .75em;
    --smallestTextSize: .618em;

/*===== 
    #Heading #Title #Size #Variables
    The small title sizes use the big text sizes; so they overlap
    They're here, though, so that, if desired, we can deviate and not have them overlap
=====*/
    --biggestTitleSize: 2.6179em; /* (16 x 1.618) x 1.618 */
    --bigTitleSize: 1.618em;
    --baseTitleSize: 1.5em;
    --smallTitleSize: var(--biggestTextSize);
    --smallerTitleSize: var(--biggerTextSize);
    --smallestTitleSize: var(--bigTextSize);

/*===== 
    #Spacing #Text #Size #Variables
    rem for left-right, for consistent alignment.
    em for top/bottom, so the spacing is relative to font-size  
=====*/
    --bigSpacingHorizontal: 1.618rem;
    --baseSpacingHorizontal: .618rem;

    --bigSpacingVertical: 1.618em;
    --baseSpacingVertical: .618em;

/*===== 
    #Font #FontFamilies #Typeface #Code #Heading #Paragraphs #Variables
    base is meant to be what's applied to the majority of body copy
    title could also be called "headline", but would be  w/ other vars
=====*/
    --baseFontFamily: georgia, "Times New Roman", serif;
    --titleFontFamily: helvetica, arial, sans-serif;
    --codeFontFamily: monospace;

/*===== 
    #Font #Weight #Variables
    though font-weight ranges from 100 - 900, "normal" is 400 and the ends
         are a difference of 300 .
    So the "est" weights are the extremes, with room to add 
        light, lighter, heavy, heavier. 
    Recommend adding "ultra" if the weight is > 700
=====*/
    --lightestFontWeight: 100;
    --baseFontWeight: 400;
    --heaviestFontWeight: 700;

/*===== 
    #font #style #Variables
    Oblique will use the existing font and put the glyphs at an angle
    Alternate will look for a font labelled with an italic face
    If the browser doesn't have a labelled italic font, it synthesizes oblique
=====*/
    --shiftedFontVoice: oblique 15deg;
    --baseFontVoice: normal;
    --alternateFontVoice: italic;

/*===== 
    #font #quotes #border #Variables
    These are the default quotes for English. Change these quotes-as needed for other languages
    "secondary" quotes are nested quotes. e.g. <blockquote><blockquote>
    the CSS properties 'open-quote', 'close-quote' will use the primary open and primary close quotes listed here
=====*/
    --baseTextQuotes: "\201C""\201D""\2018""\2019"; /*Primary open, primary close, secondary open, secondary close*/
    --baseQuoteBorder: 10px solid var(--colorNeutralLighter);
    --smallQuoteBorder: 5px solid var(--colorNeutralLight);

/*===== 
    #font #text #interactions #Variables
    Interactions could/should include
        idle: not being used, but an indicator that it can be
        interest: a user has shown desire to interact (e.g. hover or focus)
        active: a user is currently interacting
=====*/
    --idleTextLineStyle: dotted;
    --interestTextLineStyle: solid;
    --activeTextLineStyle: solid;
    --idleTextDecoration: var(--idleTextLineStyle) underline 2px;
}

html {
    color: var(--baseTextColor);
    font-family: var(--baseFontFamily);
    font-size: calc(.5vw + 1rem); /* the font-size can scale up as the browser window gets larger, but doesn't get hard to read when the browser window shrinks*/
    line-height: var(--baseLineHeight);
}


/*=====
  #Everything
=====*/

h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
dl,
pre {
    line-height: var(--baseLineHeight);
    margin: 0 var(--baseSpacingHorizontal);
}


/*=====
  #Headings
=====*/

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--titleFontFamily);
    font-weight: var(--heaviestFontWeight);
    line-height: var(--smallLineHeight);
    margin-bottom: calc(1.618vmin - 1vmax + .35em); /* increases margin as screen width gets smaller */
}

h1 {
    font-size: var(--biggestTitleSize);
}

h2 {
    font-size: var(--bigTitleSize);
}

h3 {
    font-size: var(--baseTitleSize);
}

h4 {
    font-size: var(--smallTitleSize);
}

h5 {
    font-size: var(--smallerTitleSize);
}

h6 {
    font-size: var(--smallestTitleSize);
}


/*=====
  #Lists
=====*/

ul,
ol,
dl,
menu {
    padding: var(--baseSpacingVertical) var(--baseSpacingHorizontal);
}

li {
    list-style-position: inside;
    text-indent: -.9em; /*this brings the left text aligned with the text of a <dd> element*/
    line-height: var(--baseLineHeight);
    padding: 0;
    margin: 0 0 0 var(--baseSpacingHorizontal);
}

nav li,
menu li {
    list-style-type: none;
    text-indent: 0;
    margin: 0;
}

dt {
    text-indent: calc(-1 * var(--baseSpacingHorizontal));
}

dd {
    padding: 0 var(--baseSpacingHorizontal);
    margin: 0;
}


/*=====
  #Paragraphs #Blocks
=====*/

hr {
    color: var(--colorNeutral);
    border-width: .0625em;
    border-style: solid;
    margin: var(--bigSpacingVertical) var(--baseSpacingHorizontal);
}

p,
blockquote {
    line-height: var(--baseLineHeight);
}

p {
    font-size: var(--baseTextSize);
    margin-bottom: var(--baseSpacingVertical);
}

blockquote,
q {
    quotes: var(--baseTextQuotes);
}

blockquote::before,
q::before {
    content: open-quote;
}

/* Credit where it's due:
    https://css-tricks.com/snippets/css/simple-and-nice-blockquote-styling/
*/
blockquote {
    padding: var(--baseSpacingVertical) var(--baseSpacingHorizontal);
    border-left: var(--baseQuoteBorder);
    background: rgba(var(--baseQuoteBackgroundColor) 0.15);
    margin: var(--bigSpacingVertical) var(--baseSpacingHorizontal);
}

blockquote::before,
blockquote::after {
    color: var(--colorNeutralDark); /* Any lighter and it won't pass WCAG AA */
    vertical-align: -0.5em;
    font-size: 4em;
    line-height: 0.1em;
}

blockquote::before {
    margin-right: var(--baseSpacingHorizontal);
}

blockquote::after {
    content: no-close-quote;
}

q::after {
    content: close-quote;
}


/*=====
  #Content-Flow
=====*/

em,
i,
cite {
    font-style: var(--alternateFontVoice);
}

strong,
b {
    font-weight: var(--heaviestFontWeight);
}

cite {
    display: block;
    text-align: right;
}

small,
sub,
sup {
    font-size: var(--smallestTextSize);
    line-height: 1;
}

sub {
    vertical-align: sub;
}

sup {
    vertical-align: super;
}


/*=====
  #Content-Flow #editorial
=====*/

s,
strike,
del,
ins {
    color: var(--baseEditorialTextColor);
}

s,
strike,
del {
    text-decoration: line-through;
}

ins,
del {
    background-color: rgba(217, 217, 217, 0.25);
}

ins {
    text-decoration: none;
}

/* U is for misspelled words. Invite user to make a correction */
u {
    text-decoration: var(--idleTextDecoration);
    text-decoration-color: var(--alertTextLineColor);
}

/*
mark and selection should be different so user knows which one they've selected.
*/

/* hue: 120, saturation: 45%, lightness: 73%  */
mark {
    background-color: rgba(155, 217, 155, 0.9);
}

/*hue: 180, saturation: 45%, lightness: 73%*/
::selection {
    background-color: rgba(155, 217, 217, 0.9);
}

/* Because mark and selection have same saturation and brightness, a selected <mark> won't stand out
    A hue between 120 and 180 seems to stand out the best in all colorblind tests, too
    hue: 150, saturation: 44%, lightness: 65%
 */
mark::selection {
    background-color: rgba(126, 205, 166, 0.9);
}

/* dfn and dt both do the same thing: denote a term to be defined */
dfn,
dt {
    font-weight: var(--heaviestFontWeight);
    font-style: var(--shiftedFontVoice);
    text-transform: capitalize;
}

abbr {
    text-transform: uppercase;
    text-decoration: none;
}

/* an abbreviation with a title should invite a user to hover over it*/
abbr[title] {
    text-decoration: var(--idleTextDecoration);
}


/*=====
#Content-flow #Code
=====*/

pre,
code,
var,
samp,
data {
    font-family: var(--codeFontFamily);
}

kbd,
samp,
data {
    background-color: rgba(var(--baseQuoteBackgroundColor) 0.2);
}

kbd {
    font-size: var(--smallerTextSize);
    padding: .25ex .5ex;
    border: 1px solid  var(--baseInlineBorderColor);
    border-radius: 3px;
}

/*Treat samp like a mini blockquote. because basically you're quoting what the computer would do*/
samp,
data {
    padding: 0 10px;
}

var,
data {
    font-style: var(--alternateFontVoice);
}

samp {
    border-left: var(--smallQuoteBorder);
}

pre {
    overflow: scroll;
    font-size: var(--smallerTextSize);
    line-height: var(--smallLineHeight);
    padding: var(--baseSpacingVertical) var(--baseSpacingHorizontal);
    border: 1px solid var(--baseInlineBorderColor);
    border-radius: 2px;
}


/*=====
  #Ruby
=====*/

ruby {
    position: relative;
    display: ruby;
    margin:0 .5ex;
    -webkit-ruby-position: before;
    ruby-position: over;
    ruby-position: before;
}

rtc, rbc {
    font-size: inherit;
    line-height: 1;
    ruby-align: start;
}

rt {
    display: ruby-text;
    font-size: .7em;
}

rt + rt {
    margin-left: .5ex;
}

rtc > bdo {
    display: -webkit-ruby-text-container;
    display: ruby-base-container;
}

/*complex ruby for chrome and Edge*/

/*only FF has "complete" ruby support*/
@supports (ruby-align: left) or ( not (display:ruby-base-container))  {
    ruby {
        display:inline-flex;
        flex-direction: column;
        vertical-align: 1em;
        line-height: 1;
    }

    rtc, rt {
        order: -1;
        flex-grow: 1;
        flex-shrink: 0;
    }

    rtc {
        display: inline-flex;
    }
}

/*Edge fixes*/
@supports  ((ruby-align: left)) {
    rtc {
        justify-content: space-between;
    }

    rt {
        display: inline-flex;
    }
}


/*=====
#Links
=====*/

a {
    color: var(--baseLinkColor);
    text-decoration: none;
    border-bottom: 1px var(--idleTextLineStyle);
    transition: all .3s ease-in-out;
}

a:hover,
a:focus {
    color: var(--baseLinkColorHover);
    border-bottom-style: var(--interestTextLineStyle);
    outline: none;
}

a:active {
    border-bottom-style: var(--activeTextLineStyle);
}


/*==========
#Table
==========*/

table {
    font-size:  var(--smallTextSize);
}

caption {
    font-style: var(--alternateFontVoice);
    text-transform: capitalize;
    font-size:  var(--baseTextSize);
}

th, td {
    text-align: left;
    vertical-align: middle;
    line-height: var(--smallLineHeight);
    padding: .4em var(--baseSpacingHorizontal);
}

th {
    font-family: var(--titleFontFamily);
    font-weight: var(--heaviestFontWeight);
    font-size: var(--smallTitleSize); /*treat th in a body as h4*/
}

thead th,
tfoot th {
    font-size: var(--baseTitleSize); /*treat th in header/footer as h3*/
}

              
            
!

JS

              
                
              
            
!
999px

Console