Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="ns-container">
   <h1>Mastodon Light</h1>
   <ins data-title="えあいの投稿" data-acct="Eai@stellaria.network" data-nocss="1">
   </ins>
</div>
<div class="ns-container dark">
   <h1>Mastodon Dark</h1>
   <ins data-title="おさの「テスト」を含む投稿" data-acct="osapon@mstdn.nere9.help" data-keyword="テスト" data-nocss="1">
   </ins>
</div>
<div class="ns-container">
   <h1>使い方</h1>
   <p>後で書きますお待ち下さい。</p>
</div>
<script src="https://notestock.osa-p.net/_js/notestock_widget.js" defer></script>

<style>
<!--    CodePenで見せるためのCSS -->
   * {
      box-sizing: border-box;
   }

   body .ns-container {
      display: flex;
      align-items: center;
      position: relative;
      width: 100%;
      height: 100vh;
      background: #fff;
   }

   body .ns-container>h1 {
      font-family: "Open Sans Condensed", sans-serif;
      position: absolute;
      top: 0;
      right: 0;
      color: black;
      opacity: 0.75;
      padding: 0 15px;
      font-size: 48px;
   }

   body .ns-container.dark>h1 {
      left: 0;
      color: white;
   }
</style>
              
            
!

CSS

              
                // WIP

// .ns-attachのmarginが.ns-sensitiveに飲み込まれている
// 絵文字の高さ
// もっと見るの高さ
// もっと見るが小さい
// もっと見るを押した後、警告文のmarginがなくなる

//カスタマイズ
.ns-frame {
   --widget-width: 500px;
   --widget-height: 500px;
   --title-text-size: 21px;
   --title-padding-size: 20px;
   --content-text-size: 15px;
   --content-padding-size: 15px;
   --icon-width: 36px;
   --name-size: 16px;
}

// 共通カラースキーム
.ns-frame {
   --link-color: #2b90d9;
}

// カラースキーム
.ns-container {
   .ns-frame {
      --bg-color: #fff;
      --border-color: #c0cdd9;
      --text-color: #282c37;
      --name-text-color: #000;
      --name-gray-color: #444b5d;
      --time-text-color: #444b5d;
      --spoiler-bg-color: #d9e1e8;
      --spoiler-bg-hover-color: #ccd7e0;
      --spoiler-text-color: #000;
      --scrollbar-thumb-color: #ccd7e0;
      --scrollbar-track-color: rgba(255, 255, 255, 0.1);
   }

   &.dark {
      background: #191b22;
      .ns-frame {
         --bg-color: #282c37;
         --border-color: transparent;
         --text-color: #fff;
         --name-text-color: #fff;
         --name-gray-color: #606984;
         --time-text-color: #606984;
         --spoiler-bg-color: #606984;
         --spoiler-bg-hover-color: #707b97;
         --spoiler-text-color: #282c37;
         --scrollbar-thumb-color: #313543;
         --scrollbar-track-color: rgba(0, 0, 0, 0.1);
      }
   }
}

.ns-frame {
   ::-webkit-scrollbar {
      width: 12px;
      height: 12px;
   }
   ::-webkit-scrollbar-corner {
      background: transparent;
   }
   ::-webkit-scrollbar-thumb {
      background: var(--scrollbar-thumb-color);
      border: none;
      border-radius: 0;
   }
   ::-webkit-scrollbar-track {
      border: 0 #fff;
      border-radius: 0;
      background: var(--scrollbar-track-color);
   }
   .emoji {
      vertical-align: middle;
      object-fit: contain;
      max-width: 1em;
      max-height: 1em;
   }
   a {
      color: var(--link-color);
      text-decoration: none;
      &:hover {
         text-decoration: underline;
      }
   }
   position: relative;
   width: 80%;
   max-width: var(--widget-width);
   height: var(--widget-height);
   margin: auto;
   border-radius: 4px;
   background: var(--bg-color);
   box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
   border: 1px solid var(--border-color);
   color: var(--text-color);

   .ns-title {
      padding: var(--title-padding-size);
      font-size: var(--title-text-size);
      font-weight: 600;
      line-height: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      a {
         color: #e02691;
      }
   }
   .ns-statusframe {
      height: calc(
         100% - var(--title-padding-size) * 2 - var(--title-text-size)
      );
      overflow: auto;
      overflow-wrap: break-word;
      scroll-snap-type: y proximity;
      > div {
         padding: var(--content-padding-size) var(--content-padding-size)
            var(--content-padding-size)
            calc(
               var(--content-padding-size) + var(--icon-width) +
                  var(--content-padding-size)
            );
         position: relative;
         scroll-snap-align: start;
      }
      .ns-avatar {
         display: flex;
         .ns-icon {
            position: absolute;
            left: var(--content-padding-size);
            top: var(--content-padding-size);
            border-radius: 4px;
            width: var(--icon-width);
         }
         .ns-avatarname {
            font-size: var(--name-size);
            color: var(--name-text-color);
         }
         .ns-subject {
            font-size: 13px;
            line-height: 18px;

            color: var(--name-gray-color);
         }
      }
      .ns-summary {
         margin-top: 5px;
         font-size: var(--content-text-size);
         line-height: 1.5;
         & + .ns-content {
            display: none;
         }
         > span:last-child {
            font-size: 0;
            &:after {
               content: "もっと見る";
               background: var(--spoiler-bg-color);
               color: var(--spoiler-text-color);
               border-radius: 2px;
               font-weight: 700;
               font-size: 11px;
               padding: 0 6px;
               margin-left: 0.5em;
               margin-top: 2px;
            }
            &:hover:after {
               background: var(--spoiler-bg-hover-color);
            }
         }
      }
      .ns-content {
         width: 100%;
         margin-top: 5px;
         p {
            margin: 0;
            font-size: var(--content-text-size);
            line-height: 1.5;
         }
         .ns-attach {
            > div {
               margin-top: 5px;
               display: block;
               * {
                  max-width: 100%;
                  border-radius: 4px;
                  vertical-align: bottom;
               }
            }
         }
         .ns-sensitive {
            position: relative;
            margin-top: 5px;
            > span {
               position: absolute;
               background: rgba(0, 0, 0, 0.5);
               top: 0;
               right: 0;
               bottom: 0;
               left: 0;
               z-index: 2;
               font-size: 0;
               border-radius: 4px;
               &:after {
                  position: absolute;
                  background: rgba(0, 0, 0, 0.5);
                  border-radius: 8px;
                  padding: 8px 12px;
                  color: var(--text-color);
                  font-weight: 500;
                  content: "閲覧注意";
                  font-size: 1rem;
                  top: 50%;
                  left: 50%;
                  transform: translateY(-50%) translateX(-50%);
               }
            }
            &.ns-contenthide .ns-attach {
               max-height: 250px;
               overflow: hidden;
               > div {
                  filter: blur(5px);
                  &:first-child {
                     margin-top: 0;
                  }
               }
            }
         }
      }
      .ns-published {
         display: block;
         margin-top: 10px;
         font-size: 13px;
         line-height: 18px;
         a {
            color: var(--time-text-color);
         }
      }
   }

   .ns-byframe {
      position: absolute;
      top: calc(var(--title-padding-size) + var(--title-text-size) + 2.5px);
      right: var(--content-padding-size);
      height: 1em;
      font-size: 12px;
      line-height: 1;
      vertical-align: middle;
      .ns-logo {
         display: inline-block;
         background: #fff;
         padding: 1px 3px;
         border-radius: 3px;
         svg {
            vertical-align: middle;
            height: 12px;
         }
      }
   }
}
              
            
!

JS

              
                
              
            
!
999px

Console