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

              
                <link rel="stylesheet" href="https://unpkg.com/qiita-widget@2.0.1/dist/style.css">

<!-- Widget挿入位置 -->
<section class="qiita-widget js-qiita-widget">
  <header class="qiita-widget__header qiita-user js-qiita-user"></header>
  <section class="qiita-widget__articles">
    <h2 class="qiita-widget__articles-head transition transition--s4"><span class="transition__inner js-subject"></span>
    </h2>
    <ul class="qiita-article-list js-qiita-article"></ul>
  </section>
</section>
<!-- Widget挿入位置 -->

<!-- HTMLテンプレート -->
<template id="qiita-user-tpl">
  <p class="qiita-user__image transition transition--s1"><img class="qiita-user__img js-profile-image-url transition__inner" src="" alt="" /></p>

  <div class="qiita-user__title">
    <a class="qiita-user__url js-url transition transition--s2" target="_blank"><h1 class="qiita-user__id js-id transition__inner"></h1></a>

    <p class="qiita-user__items transition transition--s3">
      <span class="qiita-user__items-num js-items-count transition__inner"></span>
      <span class="qiita-user__items-unit transition__inner">Items</span>
    </p>

    <p class="qiita-user__likes transition transition--s3">
      <span class="qiita-user__likes-num js-likes-count transition__inner"></span>
      <span class="qiita-user__likes-unit transition__inner">Contribution</span>
    </p>

  </div>
</template>

<template id="qiita-article-tpl">
  <li class="qiita-article-list__item transition transition--s5">
    <a class="qiita-article js-url transition transition__inner" target="_blank">
      <h3 class="qiita-article__title js-title"></h3>
    </a>
  </li>
</template>
<!-- HTMLテンプレート -->

<script src="https://unpkg.com/qiita-widget@2.1.1/dist/lib.bundled.js"></script>

              
            
!

CSS

              
                // already reseted by reset.css

.qiita-widget {
  border: 1px solid #ddd;
  padding: 1em;
  margin: 1em;
  width: 320px;
}
              
            
!

JS

              
                const container = document.querySelector('.js-qiita-widget');
new QiitaWidget(container, {
  // 見出し
  subject: '人気の記事',
  // QiitaのユーザーID
  userId: 'qiita',
  // trueで表示記事をランダムに選択する
  useShuffle: false,
  // trueで投稿を「いいね」数順でソートする
  sortByLike: true,
  // trueでロード直後のアニメーションを表示
  useTransition: true,
  // 表示する記事の最低いいね数(0でフィルタ無効)
  filterByLikesFrom: 0,
  // 最終的に表示する記事の件数
  maxToShow: 5,
  // JSONレスポンスのキャッシュ有効時間(分)
  cacheAgeMin: 15,
  // 一度のリクエストで取得する記事数(1〜100)
  perPage: 100,
  // perPage * maxRequest = 取得を試みる最大記事件数 
  maxRequest: 10
}).init();
              
            
!
999px

Console