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="Image formats">Formats d’images</h1>
    <p><em data-lang-en="Weight of the images and background patterns are displayed when hovering or focusing on them, or when clicking on the following button. [br /][button]Show weight and background patterns[/button]">Les poids des images et les trames de fonds sont affichés au survol, au focus ou en cliquant sur le bouton suivant.<br /><button>Afficher les poids et les trames de fonds</button></em></p>
  </div>
  <div class="bloc">
    <div class="container">
      <h2 data-lang-en="Gif format">Format gif</h2>
      <div class="content" tabindex="0">
        <span data-content="16"><img src="http://codepen.vincent-valentin.name/img/chat.gif" alt="" /></span>
        <span data-content="17"><img src="http://codepen.vincent-valentin.name/img/des.gif" alt="" /></span>
        <span data-content="199"><img src="http://codepen.vincent-valentin.name/img/pendule.gif" alt="" /></span>
      </div>
    </div>
  </div><div class="bloc">
    <div class="container">
      <h2 data-lang-en="Png format">Format png</h2>
      <div class="content" tabindex="0">
        <span data-content="93"><img src="http://codepen.vincent-valentin.name/img/chat.png" alt="" /></span>
        <span data-content="53"><img src="http://codepen.vincent-valentin.name/img/des.png" alt="" /></span>
        <span data-content="48"><img src="http://codepen.vincent-valentin.name/img/pendule.png" alt="" /></span>
      </div>
    </div>
  </div><div class="bloc">
    <div class="container">
      <h2 data-lang-en="Jpeg format">Format jpeg</h2>
      <div class="content" tabindex="0">
        <span data-content="32"><img src="http://codepen.vincent-valentin.name/img/chat.jpg" alt="" /></span>
        <span data-content="19"><img src="http://codepen.vincent-valentin.name/img/des.jpg" alt="" /></span>
        <span data-content="17"><img src="http://codepen.vincent-valentin.name/img/pendule.jpg" alt="" /></span>
      </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
{
  border: 1px solid #e7e4e2;
  margin: 1em;
  padding: 2em 2em 0;
  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;
  }
}

.bloc
{
  em
  {
    background-color: #ffdf7f;
    display: block;
    padding: 1em;
  }
}
img
{
  display: block;
  margin-bottom: 2em;
}
.content
{
    
background-image: linear-gradient(45deg, white 25%, transparent 25%, transparent 75%, white 75%, white), 
linear-gradient(45deg, white 25%, transparent 25%, transparent 75%, white 75%, white);
background-size: 30px 30px;
background-position: 0 0, 15px 15px;
  transition: background-color 300ms;

  
  &:hover,
  &:focus,
  &.active
  {
    background-color: rgb(128, 128, 128);
    
    span
    {
      &:before
      {
        opacity: 1;
      }
    }
  }
  span
  {
    display: block;
    position: relative;
    
    &:before
    {
      opacity: 0;
      content: attr(data-content) ' Ko';
      position: absolute;
      left: 50%;
      top: 50%;
      font-size: 2em;
      width: 100px;
      height: 1.25em;
      margin-top: -0.625em;
      margin-left: -50px;
      text-align: center;
      background-color: #fff;
      transition: opacity 300ms;
    }
  }
}

            
          
!
            
              $(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