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="wrapper">
  <section class="card">
    <h2 class="title">りんご</h2>
    <div class="thumbnail">
      <img src="https://source.unsplash.com/CoqJGsFVJtM" alt="" width="16" height="9" decoding="async" fetchpriority="high" />
    </div>
    <p class="description">こだわりの農法で育てた新鮮なりんご、直送でお届けします。私たちのりんごは、一つ一つ手間ひまかけて育てられたこだわりの品です。甘みと酸味のバランスが絶妙で、歯ごたえも抜群。一口かじれば、じゅわっと広がる果汁があなたの心をリフレッシュします。</p>
    <div class="price">
      <p>価格:&yen;120</p>
    </div>
  </section>
  <section class="card">
    <h2 class="title">みかん</h2>
    <div class="thumbnail">
      <img src="https://source.unsplash.com/N0SAV7OCwxM" alt="" width="16" height="9" decoding="async" fetchpriority="high" />
    </div>
    <p class="description">こだわりの農法で育てた新鮮なみかん、直送でお届けします。</p>
    <div class="price">
      <p>価格:&yen;420</p>
      <p>1個あたり60円となります</p>
    </div>
  </section>
  <section class="card">
    <h2 class="title">バナナ</h2>
    <div class="thumbnail">
      <img src="https://source.unsplash.com/VI2rIoZUrks" alt="" width="16" height="9" decoding="async" fetchpriority="high" />
    </div>
    <p class="description">こだわりの農法で育てた新鮮なバナナ、直送でお届けします。</p>
    <div class="price">
      <p>価格:&yen;240</p>
    </div>
  </section>
</div>
              
            
!

CSS

              
                :root {
  --c-black: #2a2a2a;
  --c-gray: #dadada;
  --c-smoke: #eee;
  --c-white: #f7f7f7;
  --h-header: 56px;
}

:where(*, ::before, ::after) {
  box-sizing: border-box;
  min-inline-size: 0;
  margin: 0;
  border-style: solid;
  border-width: 0;
}

:where(html) {
  line-height: 1.15;
  text-align: start;
  overflow-wrap: break-word;
  touch-action: manipulation;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  line-break: strict;
}

:where(body) {
  min-block-size: 100svb;
  padding-block: 40px;
  padding-inline: max(5vi, 20px);
  margin: 0;
  line-height: 1.6;
  color: var(--c-black);
  background-color: var(--c-white);
}

:where(a:link, a:visited, a:hover, a:active) {
  color: inherit;
  text-decoration: none;
  background-color: transparent;
}

.wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-inline-size: 1200px;
  margin-inline: auto;
}

.card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 4;
  gap: 1.5em;
  min-inline-size: 320px;
  padding: 1.5em;
  background-color: var(--c-smoke);
}

.title {
  grid-row: 2 / 3;
  font-size: 1.15rem;
  line-height: 1.25;
}

.thumbnail {
  aspect-ratio: 16 / 9;
  margin-inline: -1.5em;
  margin-block-start: -1.5em;
  contain: strict;
}

.thumbnail > img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.description {
  display: -webkit-box;
  text-overflow: ellipsis;
  -webkit-box-orient: block-axis;
  -webkit-line-clamp: 3;
  contain: content;
}

.price {
  padding-block-start: 1.5em;
  border-block-start: 1px solid var(--c-gray);
}

              
            
!

JS

              
                
              
            
!
999px

Console