Pen Settings



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


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


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.


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.


                <article role="article">

  <h1>Introduction to web typography</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's computer or a fallback font, such as a browser's default sans-serif or monospace font, would be used. The first <i>Cascading Style Sheets</i> specification was published in <b>1996</b> and provided the same capabilities.</p>

  <p>The CSS2 specification 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>1</sup> Font downloading was later included in the CSS3 fonts module, 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>


  <p>In the first CSS specification,<sup>2</sup> authors specified font characteristics via a series of properties:</p>


  <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&rsquo;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>3</sup></p>

  <p>Some CSS2 font properties were removed from CSS2.1 and later included in CSS3.<sup>4</sup> <sup>5</sup></p>

  <h3>Fallback fonts</h3>

  <p>The CSS specification allows for multiple fonts to be listed as fallback fonts.<sup>6</sup> 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>6</sup></p>

    <dd>Fonts that do not have decorative markings, or serifs, on their letters. These fonts are often considered easier to read on screens.<sup>7</sup></dd>

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

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

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

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

  <h2>Web fonts</h2>


  <p>A technique to download remote fonts was first specified in the CSS2 specification, which introduced the <a href="" target="_blank"><code>@font-face</code></a> rule.</p>

  <p>It was (and remains<sup>8</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>9</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;&#8230;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>10</sup></p>

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


  <a href="" target="_blank">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's source code. A WebFont Player plugin was available for Internet Explorer, but the technology had to compete against Microsoft's Embedded OpenType fonts, natively supported since version 4.0.

  <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>11</sup></p>

  <h4>Scalable Vector Graphics</h4>

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

    <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>12</sup>, and WebKit since version 325 also supports this method using SVG fonts only.</li>


  <p>Linking to industry-standard TrueType (TTF) and OpenType (TTF/OTF) fonts are supported by Mozilla Firefox 3.5+, Opera 10+,<sup>13</sup> Safari 3.1+,<sup>14</sup> Google Chrome 4.0+.<sup>15</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> 
  font-family: 'Journal'; src:url('') format('woff'),<br> 
  url('') format('svg'),<br>
  url('') format('truetype'),<br> 
  url('') format('embedded-opentype');<br>
  font-weight: normal;<br>
  font-style: normal;<br>
      <cite>Garaffa, Dave (2 September 1997). <a rel="nofollow" href="">"Embedded Fonts In Microsoft IE4pr2"</a>. <a href="/wiki/" title="" ></a>. Archived from <a rel="nofollow" href="">the original</a> on 8 July 1998.</cite>

      <li><cite><a rel="nofollow" href=""><i>Cascading Style Sheets, level 1</i></a>, W3C, 1996-12-17</cite></li>

      <li><cite><a rel="nofollow" href="">"Fonts"</a>, <i>Cascading Style Sheets, level 2:CSS2 Specification</i> (<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><cite><a rel="nofollow" href=""><i>CSS2.1 Changes&nbsp;—C.2.97 Chapter 15 Fonts</i></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><cite><a rel="nofollow" href=""><i>CSS3 module: Web Fonts</i></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><cite><a rel="nofollow" href="">"CSS2 specification"</a>, <i>Fonts</i> (<a href="/wiki/World_Wide_Web_Consortium" title="World Wide Web Consortium">World Wide Web Consortium</a>)</cite></li>

      <li><cite>Poole, Alex (2005-04-07), <a rel="nofollow" href=""><i>Which Are More Legible: Serif or Sans Serif Typefaces?</i></a>, retrieved 2010-01-30</cite></li>

      <li><cite>Hill, Bill (2008-07-21), <a rel="nofollow" href=""><i>Font Embedding on the Web</i></a>, Microsoft</cite></li>

      <li><cite>Kimler, Scott Thomas (2009-07-04), <a rel="nofollow" href=""><i>xBrowser Fonts&nbsp;— Expand Your Font Palette Using CSS3</i></a>, retrieved 2010-02-05</cite></li>

      <li><cite>Wubben, Mark (February 27, 2009). <a rel="nofollow" class="external text" href="">"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><cite>Daggett, John (2009-07-31), <a rel="nofollow" href=""><i>EOT-Lite File Format v.1.1</i></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><cite>Mills, Chris (2008-12-04), <a rel="nofollow" href=""><i>Opera Presto 2.2 and Opera 10&nbsp;— a first look</i></a>, <a href="/wiki/Opera_Software" title="Opera Software">Opera Software</a>, retrieved 2010-01-30</cite></li>

      <li><cite>Mills, Chris (2008-12-04), <a rel="nofollow" href=""><i>Opera Presto 2.2 and Opera 10&nbsp;— a first look</i></a>, Opera Developer Community, retrieved 2010-01-29</cite></li>

      <li><cite>Marsal, Katie (2008-02-07), <a rel="nofollow" href=""><i>Apple's Safari 3.1 to support downloadable web fonts, more</i></a>, <a href="/wiki/AppleInsider" title="AppleInsider">AppleInsider</a>, retrieved 2010-02-05</cite></li>

      <li><cite>Irish, Paul (2010-01-25), <a rel="nofollow" href=""><i>Chrome and @font-face: It's here!</i></a></cite></li>
  <div id="element"><span id="w2"></span>px<span id="h2"></span></div>



html {


@media screen and (min-width: 600px) {
  html {


body {


i, em {


b, strong {


a {


a:hover {


code {


h1 {


h1 + p {


h2 {


h2 + p {


h3 {


h3 + p {


h4 {


h4 + p {


h5 {


h5 + p {


h6 {


h6 + p {


sup, sub {


ul {


ul li {


ol {


ol li {


p + ul, p + ol {


dt {


dd {


body {
  background-color: #fff;
  box-sizing: border-box;
  margin: 20px auto;
  max-width: 1280px;
  padding: 0 20px;
  width: 100%;

#element {
  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 - 40px);
  top: 0;
  width: 100%;
  z-index: 1000;

#h2 {
  display: none;

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


                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;

(function() {
    var eles = document.getElementsByClassName("character-count");
    for (var i = 0; i < eles.length; 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>');

function togglehighlight() {
    if (!document.body.classList.contains('highlight-off'))

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