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

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 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="[abbr]HTML[/abbr] semantics">Sémantique <abbr>HTML</abbr></h1>
  <p><em data-lang-en="Get a better understanding of how machines see your code by disabling [abbr]CSS[/abbr]. [button]Disable stylesheets[/button]">On peut simuler la perception de la page par les machines quand <abbr>CSS</abbr> est désactivé. <button>Désactiver le <abbr>CSS</abbr></button></em></p>
</div>
<div class="bloc css">
  <h2 data-lang-en="With a semantic layer">Avec une couche sémantique</h2>
  <div class="content" lang="la">
    <h3>Donec et mollis dolor</h3>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor.
    </p>
    <ul>
      <li><a href="#">Nam</a></li>
      <li><a href="#">Tincidunt</li>
      <li><a href="#">Congue</a></li>
    </ul>
    <h3>Donec et mollis dolor</h3>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor.
    </p>
    <p>
      Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.
    </p>
  </div>
</div><!--
--><div class="bloc css">
  <h2 data-lang-en="Without a semantic layer">Sans couche sémantique</h2>
  <div class="content" lang="la">
    <div class="h3">Donec et mollis dolor</div>
    <div class="p">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor.
    </div>
    <div class="ul">
      <div><a href="#">Nam</a></div>
      <div><a href="#">Tincidunt</a></div>
      <div><a href="#">Congue</a></div>
    </div>
    <div class="h3">Donec et mollis dolor</div>
    <div class="p">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor.
    </div>
    <div class="p">
      Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.
    </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>
              
            
!

CSS

              
                @import "compass/css3";

@import 'compass';

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;
  display: inline-block;
  vertical-align: top;
  text-align: left;
  background-color: white;
  position: relative;
}
h1,
h2
{
  
  margin-top: 0;
}
img
{
  margin: auto;
  display: block;
}
.intro
{
  max-width: 600px;
  margin: auto;
  font-size: 1.5em;
  padding: 4em 0;
  
  em
  {
    font-style: normal;
  }
  button
  {
    display: block;
    margin: 2em auto 0;
    border: 0;
    padding: 1em;
    background-color: #5B537E;
    color: #fff;
    line-height: 1.25;
    font-size: 0.85em;
    transition: background-color 300ms;
    
    &: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;
  }
}
.content
{
  font-family: serif;
  
  a
  {
    color: blue;
  }
}
.css
{
  .content
  {
    font-family: "Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif;
    
    a
    {
      color: #5B537E;
    }
  }
  
	ul,
  .ul
  {
    @include clearfix;
    padding: 0;
    margin: 0 0 1em;

    & > *
    {
      float: left;
      list-style-type: none;
      margin-right: 2em;
    }
  }
  p,
  .p
  {
    margin: 1em 0;
  }
  h3,
  .h3
  {
    font-size: 1.25em;
    margin: 0.75em 0;
    font-weight: bold;
  } 
}
.lang
{
  position: absolute;
  right:  0;
  top:    0;
  border: 0;
  padding: 0.25em 0.5em;
  background-color: #FFDF7F;
  
  abbr
  {
    border: none;
  }
}
              
            
!

JS

              
                $(function(){
  
  $('.intro').on('click', 'button', function(){

      $('.bloc').toggleClass('css');
    });
  $('[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

Console