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.

            
              <div data-html="[button class='lang' lang='en' data-lang-en='Voir en français']See in english[/button]"></div>
<div class="main" lang="fr">
<div class="intro">
  <h1 data-lang-en="Hyphenation">Coupures de mots</h1>
  <p class="info"><em data-lang-en="
Whitespaces are displayed on hover, on focus or when clicking the button below.[br /] [button class='whitespaces']
Show whitespaces[/button]">Les blancs sont affichés au survol, au focus ou en cliquant sur le bouton suivant. <br /><button class="whitespaces">Afficher les blancs</button></em></p>
  <div class="info2" data-lang-en="[p][em]Your browser does not appear to support hyphenation.
You can usually see this demonstration with Firefox, Safari or Internet Explorer.[/p]
[p]Override detection with the following button. Whitespaces will then be displayed on focus, on hover, or by clicking the second button.[br /]
[button class='hyphens']Forcing justification[/button][button class='whitespaces']Show whitespaces[/button][/em][/p]">
  <p><em>Votre navigateur ne semble pas supporter les césures <abbr>CSS</abbr>. Vous pouvez normalement voir cette démonstration avec Firefox, Safari ou Internet Explorer.</p><p>Passez outre la détection avec le bouton suivant.
    Les blancs seront alors affichés au survol, au focus ou en cliquant sur le second bouton.<br />
    <button class="hyphens">Forcer la justification</button><button class="whitespaces">Afficher les blancs</button>
    </em></p></div>
</div>
<div class="bloc">
  <div class="container cesure">
    <h2 data-lang-en="With hyphenation">Avec coupures</h2>
    <div tabindex="0" class="content">
      <p><span>Lorem</span> <span>ipsum</span> <span>dolor</span> <span>sit</span> <span>amet,</span> <span>consectetur</span> <span>adipiscing</span> <span>elit.</span> <span>Donec</span> <span>a</span> <span>diam</span> <span>lectus.</span> <span>Sed</span> <span>sit</span> <span>amet</span> <span>ipsum</span> <span>mauris.</span> <span>Maecenas</span> <span>congue</span> <span>ligula</span> <span>ac</span> <span>quam</span> <span>viverra</span> <span>nec</span> <span>consectetur</span> <span>ante</span> <span>hendrerit.</span> <span>Donec</span> <span>et</span> <span>mollis</span> <span>dolor.</span> <span>Praesent</span> <span>et</span> <span>diam</span> <span>eget</span> <span>libero</span> <span>egestas</span> <span>mattis</span> <span>sit</span> <span>amet</span> <span>vitae</span> <span>augue.</span> <span>Nam</span> <span>tincidunt</span> <span>congue</span> <span>enim,</span> <span>ut</span> <span>porta</span> <span>lorem</span> <span>lacinia</span> <span>consectetur.</span></p>
<p><span>Donec</span> <span>ut</span> <span>libero</span> <span>sed</span> <span>arcu</span> <span>vehicula</span> <span>ultricies</span> <span>a</span> <span>non</span> <span>tortor.</span> <span>Lorem</span> <span>ipsum</span> <span>dolor</span> <span>sit</span> <span>amet,</span> <span>consectetur</span> <span>adipiscing</span> <span>elit.</span> <span>Aenean</span> <span>ut</span> <span>gravida</span> <span>lorem.</span> <span>Ut</span> <span>turpis</span> <span>felis,</span> <span>pulvinar</span> <span>a</span> <span>semper</span> <span>sed,</span> <span>adipiscing</span> <span>id</span> <span>dolor.</span> <span>Pellentesque</span> <span>auctor</span> <span>nisi</span> <span>id</span> <span>magna</span> <span>consequat</span> <span>sagittis.</span> <span>Curabitur</span> <span>dapibus</span> <span>enim</span> <span>sit</span> <span>amet</span> <span>elit</span> <span>pharetra</span> <span>tincidunt</span> <span>feugiat</span> <span>nisl</span> <span>imperdiet.</span></p>
<p><span>Ut</span> <span>convallis</span> <span>libero</span> <span>in</span> <span>urna</span> <span>ultrices</span> <span>accumsan.</span> <span>Donec</span> <span>sed</span> <span>odio</span> <span>eros.</span> <span>Donec</span> <span>viverra</span> <span>mi</span> <span>quis</span> <span>quam</span> <span>pulvinar</span> <span>at</span> <span>malesuada</span> <span>arcu</span> <span>rhoncus.</span></p>
<p><span>Cum</span> <span>sociis</span> <span>natoque</span> <span>penatibus</span> <span>et</span> <span>magnis</span> <span>dis</span> <span>parturient</span> <span>montes,</span> <span>nascetur</span> <span>ridiculus</span> <span>mus.</span> <span>In</span> <span>rutrum</span> <span>accumsan</span> <span>ultricies.</span> <span>Mauris</span> <span>vitae</span> <span>nisi</span> <span>at</span> <span>sem</span> <span>facilisis</span> <span>semper</span> <span>ac</span> <span>in</span> <span>est.</span></p>
    </div>
  </div>
</div><!--
--><div class="bloc">
  <div class="container">
    <h2 data-lang-en="Without hyphenation">Sans coupure</h2>
    <div tabindex="0" class="content">
      <p><span>Lorem</span> <span>ipsum</span> <span>dolor</span> <span>sit</span> <span>amet,</span> <span>consectetur</span> <span>adipiscing</span> <span>elit.</span> <span>Donec</span> <span>a</span> <span>diam</span> <span>lectus.</span> <span>Sed</span> <span>sit</span> <span>amet</span> <span>ipsum</span> <span>mauris.</span> <span>Maecenas</span> <span>congue</span> <span>ligula</span> <span>ac</span> <span>quam</span> <span>viverra</span> <span>nec</span> <span>consectetur</span> <span>ante</span> <span>hendrerit.</span> <span>Donec</span> <span>et</span> <span>mollis</span> <span>dolor.</span> <span>Praesent</span> <span>et</span> <span>diam</span> <span>eget</span> <span>libero</span> <span>egestas</span> <span>mattis</span> <span>sit</span> <span>amet</span> <span>vitae</span> <span>augue.</span> <span>Nam</span> <span>tincidunt</span> <span>congue</span> <span>enim,</span> <span>ut</span> <span>porta</span> <span>lorem</span> <span>lacinia</span> <span>consectetur.</span></p>
<p><span>Donec</span> <span>ut</span> <span>libero</span> <span>sed</span> <span>arcu</span> <span>vehicula</span> <span>ultricies</span> <span>a</span> <span>non</span> <span>tortor.</span> <span>Lorem</span> <span>ipsum</span> <span>dolor</span> <span>sit</span> <span>amet,</span> <span>consectetur</span> <span>adipiscing</span> <span>elit.</span> <span>Aenean</span> <span>ut</span> <span>gravida</span> <span>lorem.</span> <span>Ut</span> <span>turpis</span> <span>felis,</span> <span>pulvinar</span> <span>a</span> <span>semper</span> <span>sed,</span> <span>adipiscing</span> <span>id</span> <span>dolor.</span> <span>Pellentesque</span> <span>auctor</span> <span>nisi</span> <span>id</span> <span>magna</span> <span>consequat</span> <span>sagittis.</span> <span>Curabitur</span> <span>dapibus</span> <span>enim</span> <span>sit</span> <span>amet</span> <span>elit</span> <span>pharetra</span> <span>tincidunt</span> <span>feugiat</span> <span>nisl</span> <span>imperdiet.</span></p>
<p><span>Ut</span> <span>convallis</span> <span>libero</span> <span>in</span> <span>urna</span> <span>ultrices</span> <span>accumsan.</span> <span>Donec</span> <span>sed</span> <span>odio</span> <span>eros.</span> <span>Donec</span> <span>viverra</span> <span>mi</span> <span>quis</span> <span>quam</span> <span>pulvinar</span> <span>at</span> <span>malesuada</span> <span>arcu</span> <span>rhoncus.</span></p>
<p><span>Cum</span> <span>sociis</span> <span>natoque</span> <span>penatibus</span> <span>et</span> <span>magnis</span> <span>dis</span> <span>parturient</span> <span>montes,</span> <span>nascetur</span> <span>ridiculus</span> <span>mus.</span> <span>In</span> <span>rutrum</span> <span>accumsan</span> <span>ultricies.</span> <span>Mauris</span> <span>vitae</span> <span>nisi</span> <span>at</span> <span>sem</span> <span>facilisis</span> <span>semper</span> <span>ac</span> <span>in</span> <span>est.</span></p>
    </div>
  </div>
</div>
<div class="outro">
  <p><a href="https://codepen.io/collection/JLacg/" data-lang-en="All other technical demonstrations of front-end concepts">Toutes les autres démonstrations techniques des concepts <i lang="en">front-end</i>.</a></p>
</div></div>
            
          
!
            
              @import "compass/css3";


html
{
  background-color: #fdfaf8;
  font-family: "Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif;
}
body
{
  margin: 1em;
  text-align: center;
}
img
{
  display: block;
  margin-bottom: 20px;
}
.bloc
{
  width: 320px;
  border: 1px solid #e7e4e2;
  margin: 1em;
  padding: 2em 2em 1em;
  text-align: left;
  display: inline-block;
  vertical-align: top;
  background-color: white;
}


h1,
h2
{
  margin-top: 0;
}
.intro
{
  max-width: 600px;
  margin: auto;
  font-size: 1.5em;
  padding: 4em 0;
  
  em
  {
    font-style: normal;
  }
  button
  {
    display: block;
    margin: 2em 0.5em 0;
    border: 0;
    padding: 1em;
    background-color: #5B537E;
    color: #fff;
    line-height: 1.25;
    font-size: 0.85em;
    transition: background-color 300ms;
    display: inline-block;
    
    &:hover,
    &:focus
    {
      background-color: #706a99;
    }
  }
}
.outro
{
  max-width: 600px;
  margin: auto;
  font-size: 1.5em;
  padding: 2em 0 3em;
  font-weight: bold;
  a
  {
    display: block;
  }
}
a
{
  color: #5B537E;
  transition: color 300ms;
  
  &:hover,
  &:focus,
  &:visited
  {
    color: #706a99;
  }
}
.info
{
  display: none;
  
  @supports  (hyphens: auto)
  {
    display: block;
  }
}
.info2
{
  @supports  (hyphens: auto)
  {
    display: none;
  }

}
.content
{
    @supports  (hyphens: auto)
    {
      text-align: justify;
    }
  .hyphens &
  {
    text-align: justify;
  }
}
.cesure
{
  .content
  {
    hyphens: auto;
  }
}
.content
{
  span
  {
      background-color: transparentize(black, 1);      
      transition: background-color 300ms, color 300ms, box-shadow 300ms;
  }
  
  &:hover,
  &:focus,
  &.active
  {
    span
    {
      @supports  (hyphens: auto)
      {
        color: transparentize(black, 1);
        background-color: transparentize(black, 0.8);
        text-shadow: 0 0 2px transparentize(black, 0.8);
      }
      .hyphens &
      {
        color: transparentize(black, 1);
        background-color: transparentize(black, 0.8);
        text-shadow: 0 0 2px transparentize(black, 0.8);
      }
    }
  }
}
.lang
{
  position: absolute;
  right:  0;
  top:    0;
  border: 0;
  padding: 0.25em 0.5em;
  background-color: #FFDF7F;
  
  abbr
  {
    border: none;
  }
}
            
          
!
            
              $(function(){
  $('.intro').on('click', '.whitespaces', function(){
    
    $('.bloc').find('.content').toggleClass('active');

  });
  
  $('.intro').on('click', '.hyphens', function(){
    
    $('.bloc').toggleClass('hyphens');

  });
  $('[data-html]').each(function(){

    $(this).html($(this).data('html')
                 .replace(/\[/g,'<')
                 .replace(/\]/g,'>')
                 .replace(/'/g,'"'));
  });
  
  var main    = $('.main'),
      strings = $('[data-lang-en]');
  
  var d = new Date();
      d.setTime(d.getTime() + (30*24*60*60*1000));
  var expires = d.toUTCString();
      
	strings.each(function(){

    $(this).data('lang-fr', $(this).html()
                 .replace(/</g, "[")
                 .replace(/>/g, "]")
                 .replace(/"/g, "'"));
  });
  
	$('.lang').on('click', function(){
  	
    if(main.attr('lang') === 'en')
    {
      
      $(this).attr('lang', 'en'); 
      main.attr('lang', 'fr');
      
      document.cookie="demolang=fr; expires="+  expires +"; path=/";
      
      strings.each(function(){
      	$(this).html($(this).data('lang-fr')
                 .replace(/\[/g,'<')
                 .replace(/\]/g,'>')
                 .replace(/'/g,'"'));
      });
    }
    else
    {
      main.attr('lang', 'en');
      $(this).attr('lang', 'fr');
      
      document.cookie="demolang=en; expires="+  expires +"; path=/";
      
      strings.each(function(){
      	$(this).html($(this).data('lang-en')
                 .replace(/\[/g,'<')
                 .replace(/\]/g,'>')
                 .replace(/'/g,'"'));
      });
		}
  });
  
    var cookies = document.cookie.split(';');
  
    for(var i=0; i<cookies.length; i++) {
        var c = cookies[i];
        while (c.charAt(0)==' ') c = c.substring(1);
        if (c.indexOf('demolang=') != -1)
        {
					if(c.substring('demolang='.length, c.length) === 'en')
            {
						$('.lang').trigger('click');
            }
        }
    }
  
  
});
            
          
!
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