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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

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


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.


                <article class="youtube">
  <a id="js-youtube-link" href="" class="youtube-link">
    <div class="youtube-image-wrap">
      <img id="js-youtube-image" src="" class="youtube-image">
      <span id="js-youtube-duration" class="youtube-duration"></span>
    <div class="youtube-content">
      <h1 id="js-youtube-title" class="youtube-title"></h1>
      <div class="youtube-detail">
        <span id="js-youtube-channel" class="youtube-channel" data-href=""></span> • <span id="js-youtube-views"></span> 回視聴 • <span id="js-youtube-date"></span>  
      <p id="js-youtube-description" class="youtube-description"></p>


                .youtube {
  width: 900px;
  margin: 30px auto 0;
.youtube-link {
  display: flex;
  text-decoration: none;
  color: #0d0d0d;
  border: 1px solid #0d0d0d;
  transition: opacity .6s;
  &:hover {
    opacity: .7;
.youtube-image-wrap {
  position: relative;
  width: 320px;
.youtube-image {
  width: 100%;
  vertical-align: top;
.youtube-duration {
  display: inline-block;
  position: absolute;
  right: 0;
  bottom: 0;
  color: #fff;
  font-size: 12px;
  background-color: rgba(0, 0, 0, 0.8);
    padding: 2px 6px;
.youtube-content {
  flex: 1;
  padding: 10px 20px;
.youtube-title {
  font-size: 16px;
.youtube-detail {
  font-size: 12px;
  color: #606060;
.youtube-channel {
  &:hover {
    color: #0d0d0d;
.youtube-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 14px;
  color: #606060;


const KEY = '' ;// APIKEY
const ID = 'fADXsTe05zs' ;// 動画ID
let url = ''; // APIURL
url += '?id=' + ID;
url += '&key=' + KEY;
url += '&part=snippet,contentDetails,statistics,status';

    url: url,
    dataType : 'json'
    // URL
    $('#js-youtube-link').attr('href', `${data.items[0].snippet.channelId}`);
    // サムネイル
    $('#js-youtube-image').attr('src', data.items[0].snippet.thumbnails.medium.url);
    // タイトル
    // チャンネル名
    // チャンネルURL
	const $youtubeChannel = $('#js-youtube-channel');
    $youtubeChannel.attr('data-href', `${data.items[0].snippet.channelId}`);
    // aタグ内で別のURLに遷移
    $youtubeChannel.on('click', (e) => {
      e.preventDefault();$('#js-youtube-channel').data('href'), '_blank');
    // 再生回数
    // 再生時間
    let duration = data.items[0].contentDetails.duration;
    let convertDuration = moment.duration(duration).format('hh:mm:ss');
    // 投稿日時
    let date = data.items[0].snippet.publishedAt;
    let convertDate = moment(date).fromNow();
    // 説明