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

              
                <nav class="news__tab" aria-label="お知らせメニュー">
  <ol>
    <li class="active"><a>営業情報</a></li>
    <li><a>その他</a></li>

  </ol>
</nav><!-- /.news__tab -->

<div class="news__area">
  <div class="news-card__list__wrapper show">
    <ul class="grid grid-pd2col news-card__list">
      <li class="news-card__item">
        <a href="#" class="news-card__link">
          <div class="news-card__body">
            <time>2020.12.24</time>
            <p class="news-card__txt">年末最後の営業日は27日になります。</p><!-- /.news-card__txt -->
          </div><!-- /.news-card__body -->
          <figure class="news-card__thumb"><img src="https://placehold.jp/3d4070/ffffff/103x100.png?text=news01"" alt=""></figure>
          <!-- /.news-card__thumb -->
        </a><!-- /.news-card__link -->
      </li><!-- /.news-card__item -->
      <li class="news-card__item">
        <a href="#" class="news-card__link">
          <div class="news-card__body">
            <time>2020.12.24</time>
            <p class="news-card__txt">年始最初の営業日は4日になります。</p><!-- /.news-card__txt -->
          </div><!-- /.news-card__body -->
          <figure class="news-card__thumb"><img src="https://placehold.jp/3d4070/ffffff/103x100.png?text=news02" alt=""></figure>
          <!-- /.news-card__thumb -->
        </a><!-- /.news-card__link -->
      </li><!-- /.news-card__item -->

    </ul><!-- /.grid grid-pd3colnews-card-list -->
  </div>
  <div class="news-card__list__wrapper">
    <ul class="grid grid-pd2col news-card__list">
      <li class="news-card__item">
        <a href="#" class="news-card__link">
          <div class="news-card__body">
            <time>2023.3.24</time>
            <p class="news-card__txt">ホームページをリニューアルしました。</p><!-- /.news-card__txt -->
          </div><!-- /.news-card__body -->
          <figure class="news-card__thumb"><img src="https://placehold.jp/703e3e/ffffff/103x100.png?text=Page02" alt=""></figure>
          <!-- /.news-card__thumb -->
        </a><!-- /.news-card__link -->
      </li><!-- /.news-card__item -->

    </ul><!-- /.grid grid-pd3colnews-card-list -->
  </div>
</div><!-- /.news__aria -->
              
            
!

CSS

              
                .news__nav {
    margin-top: 46px;
    text-align: center;

    ol {
        display: flex;
        justify-content: center;

        li {
            font-size: 16px;


            &:first-child {
                margin-right: 53px;
            }

            a:hover,
            a:focus {
                color: #978F10;
            }



        }
    }

}

.grid {
    display: grid;
    gap: 20px 46px;
}

//カード
.news-card__item {
    background: #F6F6F6;
    padding: 15px 30px 10px 15px;
    transition: 0.3s;
}

.news-card__link {
    display: flex;
    flex-direction: row-reverse;
    justify-content: start;
    align-items: flex-start;
}

.news-card__body {
    margin-left: 30px;

    time {
        font-size: 14px;
        line-height: 2.2;
    }
}

.news-card__txt {

    font-size: 16px;
    line-height: 2;

    .blank {
        display: none;
    }
}

.news-card__thumb {

    img {
        width: 103px;
        height: 100px;
        aspect-ratio: 1 / 1;
    }
}

    .news__inner {
        padding: 60px 25px;
    }

    .grid-pd2col {
        display: grid;
        gap: 20px;
        grid-template-columns: repeat(2, 1fr);
        max-width: 1186px;
        margin: 50px auto 0;
    }


    .grid-pd2col {
        gap: 20px 46px;
    }




    .news-card__txt {
        .blank {
            display: block;
        }
    }

//ニュースタブ
.active {
    text-decoration: underline;
}

.news__area .news-card__list {
    display: grid;
}

.news__area .news-card__list__wrapper:not(.show) {
    display: none;
}
.news__area .news-card__list__wrapper {
  position: absolute;
}
              
            
!

JS

              
                //ニュース タブ
//--------------------------------------------
$(function () {

    // ①タブをクリックしたら発動
    $('.news__tab li').click(function () {

        // ②クリックされたタブの順番を変数に格納
        var index = $('.news__tab li').index(this);

        // ③クリック済みタブのデザインを設定したcssのクラスを一旦削除
        $('.news__tab li').removeClass('active');

        // ④クリックされたタブにクリック済みデザインを適用する
        $(this).addClass('active');

        // ⑤コンテンツを一旦非表示にし、クリックされた順番のコンテンツのみを表示
        $('.news-card__list__wrapper').fadeOut(300).eq(index).fadeIn(300);

    });
});
              
            
!
999px

Console