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

              
                <section class="news">
  <div class="inner">
    <div class="news-wrapper">
      <h2 class="section-title">NEWS</h2>
      <div class="news-container">
        <a href="#" class="news-link">
          <div class="news-info">
            <time class="news-date" datetime="2024-4-1">2024-04-01</time>
            <span class="news-category">チワワ</span>
          </div>
          <h3 class="news-title">記事タイトルが入ります。</h3>
        </a>
        <a href="#" class="news-link">
          <div class="news-info">
            <time class="news-date" datetime="2024-4-1">2024-04-01</time>
            <span class="news-category">トイプードル</span>
          </div>
          <h3 class="news-title">記事タイトルが入ります。記事タイトルが入ります。</h3>
        </a>
        <a href="#" class="news-link">
          <div class="news-info">
            <time class="news-date" datetime="2024-4-1">2024-04-01</time>
            <span class="news-category">ミニチュアダックス</span>
          </div>
          <h3 class="news-title">記事タイトルが入ります。</h3>
        </a>
      </div>
    </div>
  </div>
</section>
              
            
!

CSS

              
                .news-wrapper {
  border: 1px solid #333; /* 枠線 */
  padding: 30px; /* 全体内側の余白 */
}
.news-container {
  margin-top: 20px; /* セクションタイトルとの余白 */
}
.news-link {
  align-items: center; /* 上下中央 */
  display: flex; /* 日付&カテゴリーラベルと記事タイトルの横並び */
  padding-bottom: 10px; /* 内側下の余白 */
  padding-top: 10px; /* 内側上の余白 */
  transition: background-color .5s; /* 背景色をじんわり変化 */
}
.news-link:not(:first-of-type) {
  border-top: 1px solid #ccc; /* 記事リンク間の線 */
}
.news-info {
  align-items: center; /* 上下中央 */
  display: flex; /* 日付とカテゴリーの横並び */
  flex-shrink: 0; /* これが無いと日付・カテゴリーラベルが潰れる */
  width: 240px;
}
.news-date {
  color: #333; /* 日付の文字色 */
  flex-shrink: 0; /* これが無いと日付・カテゴリーラベルが潰れる */
  font-size: 14px; /* 日付のフォントサイズ */
}
.news-category {
  background-color: #1cb4d3;
  color: #fff; /* カテゴリーラベルの文字色 */
  font-size: 20px; /* カテゴリーラベルのフォントサイズ */
  margin-left: 10px; /* カテゴリーラベル左の余白 */
  padding: 5px; /* カテゴリーラベル内側の余白 */
}
.news-title {
  color: #333; /* 記事タイトルの文字色 */
  font-size: 26px; /* 記事タイトルのフォントサイズ */
  line-height: 1.5; /* テキストの行間 */
  margin-left: 10px; /* 記事タイトル左の余白 */
}
.news-link:hover {
  background-color: #ffffe5; /* ホバーした時の記事リンクの背景色 */
}
/* レイアウトのためのスタイル */
.inner {
  margin-inline: auto;
  max-width: 600px;
  padding-left: 24px;
  padding-right: 24px;
}
a {
  text-decoration: none;
}
.news {
  margin-bottom: 20px;
  margin-top: 20px;
}
.section-title {
  font-size: 36px; /* セクションタイトルのフォントサイズ */
}
/* 画面幅400px以下のスタイル */
@media screen and (max-width: 400px) {
  .news-wrapper {
    padding: 15px;
  }
  .news-link {
    display: block; /* 日付&カテゴリーラベルと記事タイトルの横並び解除 */
  }
  .news-info {
    width: 100%;
  }
    .news-category {
    font-size: 16px; /* カテゴリーラベルのフォントサイズ */
  }
  .news-title {
    font-size: 16px; /* 記事タイトルのフォントサイズ */
    margin-left: 0; /* 記事タイトル左の余白0 */
    margin-top: 10px; /* 記事タイトル上の余白 */
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console