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.


Auto Save

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.


                <ul class="ytItems">
  <li><div id="youtube01" class="ytItem"></div></li>
  <li><div id="youtube02" class="ytItem"></div></li>
  <li><div id="youtube03" class="ytItem"></div></li>



                .ytItems {
  margin: auto;
  padding: 0;
  list-style: none;
  max-width: 300px;
.ytItem {
  position: relative;
  background: #000;
  width: 300px;
  margin-top: 30px;
.ytItem:before {
  position: absolute;
  font-family: "Font Awesome 5 Brands";
  content: "\f167";
  font-size: 3.6rem;
  opacity: .6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: opacity .6s;
.ytItem:hover:before {
    color: #FF0000;
    opacity: 1;
.ytItem img {
    width: 300px;
    height: 200px;
    object-fit: cover;
    cursor: pointer;


                var tag = document.createElement('script');
tag.src = "";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 
var youtubeData = [
    youtubeId: 'K4DyBUG242c',
    embedArea: 'youtube01'
    youtubeId: '3nQNiWdeH2Q',
    embedArea: 'youtube02'
    youtubeId: 'jK2aIUmmdP4',
    embedArea: 'youtube03'
function onYouTubeIframeAPIReady() {
  for (var i = 0; i < youtubeData.length; i++) {
   document.getElementById(youtubeData[i]['embedArea']).innerHTML = '<img id="ytThumb' + i + '" src="' + youtubeData[i]['youtubeId'] + '/sddefault.jpg">';
var ytPlayer;
function embedYoutube(num) {
  // サムネイルクリックでYouTubeを埋め込むようにする
  document.getElementById('ytThumb' + num).addEventListener('click', function() {
    ytPlayer = new YT.Player(
      youtubeData[num]['embedArea'], // 埋め込む場所の指定
        width: 300, // プレーヤーの幅
        height: 200, // プレーヤーの高さ
        videoId: youtubeData[num]['youtubeId'], // YouTubeのID
        playerVars: {
          mute: 1,
          iv_load_policy: 3,
          loop: 1,
          rel: 0
        events: {
          'onReady': onPlayerReady
function onPlayerReady(event) {;;