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

              
                <article x-data="{ liked: false, count: 0, showDetail: false }" class="card">
  <img src="https://images.microcms-assets.io/assets/c142aa641a164512aa3b02d8ec85cb04/c1c772b9acc7450f8aeb013445b88f51/noppa.JPG" alt="テントサウナ" class="card__image" />
  <div class="card__content">
    <p class="card__title">湖の辺りでテントサウナを楽しもう!</p>
    <p class="card__location">山梨県南都留郡, 西湖</p>
  </div>
  <div class="card__actions">
    <div class="card__like">
      <button @click="liked = !liked; count = liked ? count + 1 : count - 1" x-bind:aria-label="liked ? 'いいねを取り消す' : 'いいね'" class="card__like-button">
        <span x-bind:class="liked ? 'material-symbols-outlined card__heart--liked' : 'material-symbols-outlined card__heart'">favorite</span>
      </button>
      <span class="card__like-count" x-text="count > 0 ? count : ''"></span>
    </div>
    <button @click="showDetail = !showDetail;" x-bind:aria-label="showDetail ? '詳細を閉じる' : '詳細を開く'" class="card__like-button">
      <span x-text="showDetail ? 'expand_less' : 'expand_more'" class="material-symbols-outlined card__chevron"></span>
    </button>
  </div>
  <template x-if="showDetail">
    <div class="card__details">
      <p>
        テントは株式会社OLTASが作っているテントブランド、NOPPA sauna。
        組み立て簡単!ポップアップ式のキューブ型テントサウナで最高のサウナ体験ができます!
      </p>
    </div>
  </template>
</article>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background-color: #f8f8f8;
  padding: 1rem;
  margin-top: -2rem;
}

.card {
  max-width: 468px;
  width: 100%;
  height: auto;
  margin: 48px auto 0;
  background-color: #ffffff;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
}
.card__content {
  padding: 1rem;
}
.card__image {
  display: block;
  width: 100%;
}
.card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #333333;
}
.card__location {
  font-size: 0.75rem;
  color: #333333;
  margin-top: 0.25rem;
}
.card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
}
.card__details {
  padding: 0.5rem 1rem 1rem;
  color: #333333;
  line-height: 1.75;
}
.card__like {
  display: flex;
  align-items: center;
}
.card__like-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
}
.card__heart {
  font-variation-settings: "FILL" 0, "wght" 100, "GRAD" 0, "opsz" 48;
}
.card__heart--liked {
  font-variation-settings: "FILL" 1, "wght" 100, "GRAD" 0, "opsz" 48;
  color: red;
  animation: pulse 0.2s;
}
.card__chevron {
  font-variation-settings: "FILL" 0, "wght" 100, "GRAD" 0, "opsz" 48;
}
.card__like-count {
  font-size: 14px;
  line-height: 1;
  color: #333333;
  margin-top: -1px;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console