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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <div id="element"><span id="w2"></span>px<span id="h2"></span><button id="toggle">+ Toggle 45&ndash;75 characters.</button></div>

<main role="main">
  <article role="article">
    <h1 class="foo">Introduction to <a href="https://en.wikipedia.org/wiki/Web_typography" target="_blank" title="Link to orginial article">web typography</a></h1>

    <p class="character-count">Web typography refers to the use of fonts on the World Wide Web. When HTML was first created, font faces and styles were controlled exclusively by the settings of each Web browser. There was no mechanism for individual Web pages to control font display until Netscape introduced the <code>&lt;font&gt;</code> tag in 1995, which was then standardized in the HTML 2 specification. However, the font specified by the tag had to be installed on the user&rsquo;s computer or a fallback font, such as a browser’s default sans-serif or monospace font, would be used. The first Cascading Style Sheets specification was published in 1996 and provided the same capabilities.</p>

    <p>The <b>CSS2 specification</b> was released in 1998 and attempted to improve the font selection process by adding font matching, synthesis and download. These techniques did not gain much use, and were removed in the CSS2.1 specification. However, Internet Explorer added support for the font downloading feature in version 4.0, released in 1997.<sup><a href="#ref-001">1</a></sup> Font downloading was later included in the <strong>CSS3 fonts module</strong>, and has since been implemented in Safari 3.1, Opera 10 and Mozilla Firefox 3.5. This has subsequently increased interest in Web typography, as well as the usage of font downloading.</p>

    <h2>CSS1</h2>

    <p>In the first CSS specification<sup><a href="#ref-002">2</a></sup>, authors specified font characteristics via a series of properties:</p>

    <ul>
      <li>font-family</li>
      <li>font-style</li>
      <li>font-variant</li>
      <li>font-weight</li>
      <li>font-size</li>
    </ul>

    <p>All fonts were identified solely by name. Beyond the properties mentioned above, designers had no way to style fonts, and no mechanism existed to select fonts not present on the client system.</p>

    <h3>Web-safe fonts</h3>

    <p class="character-count">Web-safe fonts are fonts likely to be present on a wide range of computer systems, and used by Web content authors to increase the likelihood that content displays in their chosen font. If a visitor to a Web site does not have the specified font, their browser tries to select a similar alternative, based on the author-specified fallback fonts and generic families or it uses font substitution defined in the visitor's operating system.</p>

    <h3>Microsoft’s Core fonts for the Web</h3>

    <p>To ensure that all Web users had a basic set of fonts, Microsoft started the Core fonts for the Web initiative in 1996 (terminated in 2002). Released fonts include Arial, Courier New, Times New Roman, Comic Sans, Impact, Georgia, Trebuchet, Webdings and Verdana—under an EULA that made them freely distributable but also limited some usage rights. Their high penetration rate has made them a staple for Web designers. However, most linux distributions don't include these fonts by default.</p>

    <p>CSS2 attempted to increase the tools available to Web developers by adding font synthesis, improved font matching and the ability to download remote fonts.<sup><a href="#ref-003">3</a></sup></p>

    <p>Some CSS2 font properties were removed from CSS2.1 and later included in CSS3.<sup><a href="#ref-004">4</a></sup>,<sup><a href="#ref-005">5</a></sup></p>

    <h3>Fallback fonts</h3>

    <p>The CSS specification allows for multiple fonts to be listed as fallback fonts. 6 In CSS, the font-family property accepts a list of comma-separated font faces to use, like so:</p>

    <p><code>font-family: Helvetica, "Nimbus Sans L", "Liberation Sans", Arial, sans-serif;</code></p>

    <p>The first font specified is the preferred font. If this font is not available, the Web browser attempts to use the next font in the list. If none of the fonts specified are found, the browser displays its default font. This same process also happens on a per-character basis if the browser tries to display a character not present in the specified font.</p>

    <h3>Generic font families</h3>

    <p>To give Web designers some control over the appearance of fonts on their Web pages, even when the specified fonts are not available, the CSS specification allows the use of several generic font families. These families are designed to split fonts into several categories based on their general appearance. They are commonly specified as the last in a series of fallback fonts, as a last resort in the event that none of the fonts specified by the author are available. There are five generic families: <sup><a href="#ref-006">6</a></sup></p>

    <dl class="font-family-list">
      <dt>Sans-serif</dt>
      <dd>Fonts that do not have decorative markings, or serifs, on their letters. These fonts are often considered easier to read on screens.<sup><a href="#ref-007">7</a></sup></dd>

      <dt>Serif</dt>
      <dd>Fonts that have decorative markings, or serifs, present on their characters.</dd>

      <dt>Monospace</dt>
      <dd>Fonts in which all characters are equally wide.</dd>

      <dt>Cursive</dt>
      <dd>Fonts that resemble cursive writing. These fonts may have a decorative appearance, but they can be difficult to read at small sizes, so they are generally used sparingly.</dd>

      <dt>Fantasy</dt>
      <dd>Fonts that may contain symbols or other decorative properties, but still represent the specified character.</dd>
    </dl>

    <h2>Web fonts</h2>

    <h3>History</h3>

    <p>A technique to download remote fonts was first specified in the CSS2 specification, which introduced the <a href="http://css-tricks.com/snippets/css/using-font-face/" target="_blank" title="@font-face usage article"><code>@font-face</code></a> rule.</p>

    <p>It was (and remains <sup><a href="#ref-008">8</a></sup>) controversial because using a remote font as part of a Web page allows the font to be freely downloaded. This could result in fonts being used against the terms of their license or illegally spread through the Web. TrueDoc (PFR), Embedded OpenType (EOT) and Web Open Font Format (WOFF) are formats designed to address these issues.</p>

    <p>Since the introduction of Internet Explorer 4, font embedding employing EOT has been used mainly for displaying characters in writing systems that are not supported by default fonts. Use on English-language Web sites was virtually non-existent. With the releases of Firefox 3.5, Opera 10 and Safari 3.1, usage employing other formats is expected to increase.</p>

    <h3>File formats</h3>

    <p>By using a specific CSS @font-face embedding technique <sup><a href="#ref-009">9</a></sup> it is possible to embed fonts such that they work with IE4+, Firefox 3.5+, Safari 3.1+, Opera 10+ and Chrome 4.0+. This allows the vast majority of Web users to access this functionality. Some commercial foundries object to the redistribution of their fonts. For example, Hoefler &amp; Frere-Jones says that, while they &ldquo;&hellip;enthusiastically [support] the emergence of a more expressive Web in which designers can safely and reliably use high-quality fonts online,&rdquo; the current delivery of fonts using @font-face is considered &ldquo;illegal distribution&rdquo; by the foundry and is not permitted.<sup><a href="#ref-010">10</a></sup></p>

    <p>Naturally this does not interfere with fonts and foundries under free licenses.</p>

    <h4>TrueDoc</h4>

    <p><a href="http://www.monotype.com/libraries/bitstream/" target="_blank" title="Bitsream Company Website"> Bitstream</a> developed TrueDoc, the first standard for embedding fonts. TrueDoc was natively supported in Netscape Navigator 4, but was discontinued in Netscape Navigator 6 and Mozilla, because Netscape could not release Bitstream&rsquo;s source code. A WebFont Player plugin was available for Internet Explorer, but the technology had to compete against Microsoft&rsquo;s Embedded OpenType fonts, natively supported since version 4.0.</p>

    <h4>Embedded OpenType</h4>

    <p>Internet Explorer has supported font embedding through the proprietary Embedded OpenType standard since version 4.0. It uses digital rights management techniques to help prevent fonts from being copied and used without a license. A simplified subset of EOT has been formalized under the name of CWT Compatibility Web Type, formerly EOT-Lite.<sup><a href="#ref-011">11</a></sup></p>

    <h4>Scalable Vector Graphics</h4>

    <p>Web typography applies to SVG in two ways:</p>

    <ol>
      <li>All versions of the SVG 1.1 specification, including the SVGT subset, define a font module allowing the creation of fonts within an SVG document. Safari introduced support for many of these properties in version 3. Opera added preliminary support in version 8.0, with support for more properties in 9.0.</li>
      <li>The SVG specification lets CSS apply to SVG documents in a similar manner to HTML documents, and the @font-face rule can be applied to text in SVG documents. Opera added support for this in version 10<sup><a href="#ref-012">12</a></sup>, and WebKit since version 325 also supports this method using SVG fonts only.</li>
    </ol>

    <h4>TrueType/OpenType</h4>

    <p>Linking to industry-standard TrueType (TTF) and OpenType (TTF/OTF) fonts are supported by Mozilla Firefox 3.5+, Opera 10+, <sup><a href="#ref-013">13</a></sup> Safari 3.1+, <sup><a href="#ref-014">14</a></sup> Google Chrome 4.0+. <sup><a href="#ref-015">15</a></sup> Internet Explorer 9+ supports only those fonts with embedding permissions set to installable.</p>

    <h4>Web Open Font Format</h4>

    <p>WOFF has been supported by Mozilla Firefox 3.6+, Google Chrome 5+, Opera Presto, and is supported by Internet Explorer 9 (since March 14, 2011). Support is available on Mac OS X Lion's Safari from release 5.1.</p>

    <h4>An example of a CSS @font-face setup:</h4>
    <p>
      <code>@font-face {<br>
        <span class="code-indent">
        font-family: 'Journal';<br>
        src: url('http://your-own.site/fonts/journal/journal.woff2') format('woff2'),<br> 
        <span class="code-indent">
        url('http://your-own.site/fonts/journal/journal.woff') format('woff'),<br> 
        url('http://your-own.site/fonts/journal/journal.svg#Journal') format('svg'),<br>
        url('http://your-own.site/fonts/journal/journal.ttf') format('truetype'),<br> 
        url('http://your-own.site/fonts/journal/journal.eot'),<br>
        url('http://your-own.site/fonts/journal/journal.eot?#iefix') format('embedded-opentype');<br>
        </span>
        font-weight: normal;<br>
        font-style: normal;<br>
        </span>
      }</code>
    </p>

    <hr>

    <footer role="contentinfo">
      <h1 class="reference-heading">References</h1>
      <ol>
        <li id="ref-001">
          <cite>Garaffa, Dave (2 September 1997). <a rel="nofollow" href="http://web.archive.org/web/19980708194539/browserwatch.internet.com/news/story/microsoft265.html">“Embedded Fonts In Microsoft IE4pr2”</a>. <a href="/wiki/Internet.com" title="Internet.com" >Internet.com</a>. Archived from <a rel="nofollow" href="http://browserwatch.internet.com/news/story/microsoft265.html">the original</a> on 8 July 1998.</cite>
        </li>
        <li id="ref-002">
          <cite><a rel="nofollow" href="http://www.w3.org/TR/CSS1/">Cascading Style Sheets, level 1</a>, W3C, 1996-12-17</cite>
        </li>
        <li id="ref-003">
          <cite><a rel="nofollow" href="http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html">"Fonts"</a>, Cascading Style Sheets, level 2:CSS2 Specification (<a href="/wiki/World_Wide_Web_Consortium" title="World Wide Web Consortium">World Wide Web Consortium</a>), 1998-05-12, retrieved 2009-07-28</cite>
        </li>
        <li id="ref-005">
          <cite><a rel="nofollow" href="http://www.w3.org/TR/CSS21/changes.html#q104">CSS2.1 Changes&nbsp;—C.2.97 Chapter 15 Fonts</a>, <a href="/wiki/World_Wide_Web_Consortium" title="World Wide Web Consortium">World Wide Web Consortium</a>, retrieved 2010-01-30</cite>
        </li>
        <li id="ref-006">
          <cite><a rel="nofollow" href="http://www.w3.org/TR/css3-webfonts">CSS3 module: Web Fonts</a>, <a href="/wiki/World_Wide_Web_Consortium" title="World Wide Web Consortium">World Wide Web Consortium</a>, retrieved 2010-01-30</cite>
        </li>
        <li id="ref-007">
          <cite><a rel="nofollow" href="http://www.w3.org/TR/CSS2/fonts.html">"CSS2 specification"</a>, Fonts (<a href="/wiki/World_Wide_Web_Consortium" title="World Wide Web Consortium">World Wide Web Consortium</a>)</cite>
        </li>
        <li id="ref-008">
          <cite>Poole, Alex (2005-04-07), <a rel="nofollow" href="http://www.alexpoole.info/academic/literaturereview.html">Which Are More Legible: Serif or Sans Serif Typefaces?</a>, retrieved 2010-01-30</cite>
        </li>
        <li id="ref-009">
          <cite>Hill, Bill (2008-07-21), <a rel="nofollow" href="http://blogs.msdn.com/ie/archive/2008/07/21/font-embedding-on-the-web.aspx">Font Embedding on the Web</a>, Microsoft</cite>
        </li>
        <li id="ref-010">
          <cite>Kimler, Scott Thomas (2009-07-04), <a rel="nofollow" href="http://randsco.com/index.php/2009/07/04/cross_browser_font_embedding">xBrowser Fonts — Expand Your Font Palette Using CSS3</a>, retrieved 2010-02-05</cite>
        </li>
        <li id="ref-011">
          <cite>Wubben, Mark (February 27, 2009). <a rel="nofollow" class="external text" href="http://www.slideshare.net/novemberborn/geek-meet-web-typography-and-sifr-3#15">“Geek Meet: Web Typography and sIFR 3 - Slide 15 and 16”</a>. <a href="/wiki/SlideShare" title="SlideShare">SlideShare</a><span class="reference-accessdate">. Retrieved <span class="nowrap">17 March</span> 2010</span>.</cite>
        </li>
        <li id="ref-012">
          <cite>Daggett, John (2009-07-31), <a rel="nofollow" href="http://lists.w3.org/Archives/Public/www-font/2009JulSep/0969.html">EOT-Lite File Format v.1.1</a>, <a href="/wiki/World_Wide_Web_Consortium" title="World Wide Web Consortium">World Wide Web Consortium</a>, retrieved 2010-01-30</cite>
        </li>
        <li id="ref-013">
          <cite>Mills, Chris (2008-12-04), <a rel="nofollow" href="http://dev.opera.com/articles/view/presto-2-2-and-opera-10-a-first-look/#webfontssvg">Opera Presto 2.2 and Opera 10 — a first look</a>, <a href="/wiki/Opera_Software" title="Opera Software">Opera Software</a>, retrieved 2010-01-30</cite>
        </li>
        <li id="ref-014">
          <cite>Mills, Chris (2008-12-04), <a rel="nofollow" href="http://www.opera.com/docs/specs/presto22/#css">Opera Presto 2.2 and Opera 10 — a first look</a>, Opera Developer Community, retrieved 2010-01-29</cite>
        </li>
        <li id="ref-015">
          <cite>Marsal, Katie (2008-02-07), <a rel="nofollow" href="http://www.appleinsider.com/articles/08/02/07/apples_safari_3_1_to_support_downloadable_web_fonts_more.html">Apple's Safari 3.1 to support downloadable web fonts, more</a>, <a href="/wiki/AppleInsider" title="AppleInsider">AppleInsider</a>, retrieved 2010-02-05</cite>
        </li>
        <li id="ref-016">
          <cite>Irish, Paul (2010-01-25), <a rel="nofollow" href="http://paulirish.com/2009/chrome-and-font-face-a-summary/">Chrome and @font-face: It's here!</a></cite>
        </li>
      </ol>
    </footer>
  </article>
</main>

              
            
!

CSS

              
                /* THIS IS WHERE YOU WILL MAKE YOUR CHANGES */

@import url("https://use.typekit.net/hup3cob.css");
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono:300|Roboto+Slab:700');

body {
  font-family: "calluna-sans", sans-serif;
  font-weight: 300;
  font-style: normal;
  line-height: 1.5;
}

i, em {
  font-style: italic;
}

b, strong {
  font-weight: 600;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Roboto Slab', serif;
  font-weight: 700;
  line-height: 1.1;
}

h1 {
  font-size: 60px;
}

h2 {
  font-size: 46px;
  margin-bottom: 0;
}

h2 + p {
  margin-top: 0;
}

ol {
	list-style-type: decimal-leading-zero;
	padding-left: 2em;
}

ol li {
	margin-bottom: .75em;
}

code {
  font-family: 'Roboto Mono', monospace;
  font-weight: 300;
}




/* STOP!!!!!!! DO NOT DELETE OR CHANGE ANYTHING BELOW THIS LINE!!!!!!! */
#element {
    /* background-color: rgba(255, 0, 0, 0.5); */
    background-color: rgba(194, 240, 177, 0.5);
    color: #262626;
    font-family: 'Courier New', Courier, monospace;
    padding: 3px 5px 2px 5px;
    position: fixed;
    max-width: calc(1280px - 1.3em);
    top: 0;
    width: 100%;
    z-index: 1000;
}

#toggle {
    background-color: transparent;
    border: none;
    color: #000;
    float: right;
    font-family: 'Courier New', Courier, monospace;
    font-weight: normal;
    transition: all 300ms ease-in-out;
}

#toggle:hover {
    cursor: pointer;
    font-weight: bold;
    transition: all 300ms ease-in-out;
}

.highlight {
    background-color: rgba(194, 240, 177, 0.35);
}

.highlight-off .highlight {
    background-color: transparent;
}

#h2 {
  display: none;
}

body {
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}
              
            
!

JS

              
                // Avoid `console` errors in browsers that lack a console.
(function() {
    var method;
    var noop = function () {};
    var methods = [
        'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
        'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
        'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
        'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn'
    ];
    var length = methods.length;
    var console = (window.console = window.console || {});

    while (length--) {
        method = methods[length];

        // Only stub undefined methods.
        if (!console[method]) {
            console[method] = noop;
        }
    }
}());

// Place any jQuery/helper plugins in here.
function getViewPort(){
	$w2 = document.getElementById('w2');
	$h2 = document.getElementById('h2');
	viewPortHeight = document.documentElement.clientHeight;
	viewPortWidth = document.documentElement.clientWidth;
	elementHeight = document.getElementById('element').clientHeight;
	elementtWidth = document.getElementById('element').clientWidth;
	
	$w2.innerHTML = elementtWidth;
	$h2.innerHTML = elementHeight;
	window.onresize = function(event) {
		elementHeight = document.getElementById('element').clientHeight;
		elementtWidth = document.getElementById('element').clientWidth;
		viewPortHeight = document.documentElement.clientHeight;
		viewPortWidth = document.documentElement.clientWidth;
		$w2.innerHTML = elementtWidth;
		$h2.innerHTML = elementHeight;
	};
}getViewPort();

(function() {
    var eles = document.getElementsByClassName("character-count");
    for (var i = 0; i < eles.length; i++) {
        highlight(eles[i]);
    }
})();

function highlight(ele) {
    var str= ele.innerHTML;
    var str1 = "";
    for(var i = 45; i < 75; i++) {
        str1 += str[i];
    }
    var n=str.replace(str1,'<span class="highlight">' + str1 + '</span>');
    ele.innerHTML=n;
}

function togglehighlight() {
    if (!document.body.classList.contains('highlight-off'))
        document.body.classList.add('highlight-off');
    else
        document.body.classList.remove('highlight-off');
}

document.getElementById("toggle").addEventListener("click", togglehighlight);
              
            
!
999px

Console