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="Overflow management">Gestion des débordements</h1>
  <p><em data-lang-en="Overflows are visible on hover, on focus or on clicking the button below. [span class='info']Your browser may not display all the effects.[/span] [br /][button]Change the text size[/button]">Les débordements sont visibles au survol, au focus ou en cliquant sur le bouton suivant. <span class="info">Il est possible que votre navigateur n’affiche pas tout les effets.</span><br /><button>Changer la taille des textes</button></em></p>
</div>
<div class="bloc">
  <div class="container">
    <p><em data-lang-en="The texts which exceed may be truncated, suffixed with suspension points, cut automatically, or just switch to the line.">Les textes qui dépassent peuvent être tronqués, suffixés avec des points de suspensions, coupés automatiquement, ou simplement passer à la ligne.</em></p>
    <h2 data-lang-en="With overflow management">Avec gestion des débordements</h2>
    <div tabindex="0" class="content">
      <p class="hidden" data-lang-en="[span title='Honorificabilitudinitatibus']Honorificabilitudinitatibus[/span]"><span title="Apopathodiaphulatophobie">Apopathodiaphulatophobie</span></p>
      <p class="ellipsis" data-lang-en="[span title='Floccinaucinihilipilification']Floccinaucinihilipilification[/span]"><span title="Cyclopentanoperhydrophénenthrène">Cyclopentanoperhydrophénenthrène</span></p>
      <p class="hypens" data-lang-en="Antidisestablishmentarianism">Contraventionnalisations</p>
      <p class="wrap" data-lang-en="Pneumonoultramicroscopicsilicovolcanoconiosis">Anticonstitutionnellement</p>
    </div>
  </div>
</div><!--
--><div class="bloc">
  <div class="container">
    <p><em data-lang-en="The texts beyond out of their container and can cause the appearance of a scroll bar.">Les textes qui dépassent sortent de leur conteneur et peuvent provoquer l’apparition d’une barre de défilement.</em></p>
    <h2 data-lang-en="Without overflow management">Sans gestion des débordements</h2>
    <div tabindex="0" class="content">
      <p data-lang-en="Honorificabilitudinitatibus">Apopathodiaphulatophobie</p>
      <p data-lang-en="Floccinaucinihilipilification">Cyclopentanoperhydrophénenthrène</p>
      <p data-lang-en="Antidisestablishmentarianism">Contraventionnalisations</p>
      <p data-lang-en="Pneumonoultramicroscopicsilicovolcanoconiosis">Anticonstitutionnellement</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;
}
.bloc
{
  width: 500px;
  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;
  }
}
.lang
{
  position: absolute;
  right:  0;
  top:    0;
  border: 0;
  padding: 0.25em 0.5em;
  background-color: #FFDF7F;
  
  abbr
  {
    border: none;
  }
}
.hidden
{
  overflow: hidden;
}
.wrap
{
  word-wrap: break-word;
}
.ellipsis
{
  text-overflow: ellipsis;
  overflow: hidden;
}
.hypens
{
  hyphens: auto;
}
.bloc
{
  overflow: auto;
  
  em
  {
    background-color: #ffdf7f;
    display: block;
    padding: 1em;
    height: 3.75em;
  }
}
.content
{
  font-size: 1.25em;
  transition: font-size 300ms;
  
  &.active,
  &:hover,
  &:focus
  {
    font-size: 4em;
  }
  p
  {
    &:first-child
    {
      margin-top: 0;
    }
    &:last-child
    {
      margin-bottom: 0;
    }
  }
}
.info
{
  @supports  (hyphens: auto)
  {
    display: none;
  }
}

            
          
!
            
              $(function(){

  $('.intro').on('click', 'button', function(){
    
    $('.bloc').find('.content').toggleClass('active');

  });
  
  $('[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