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="card hidden">
  <h3 class="card-title">Card Title <span data-title="规则说明,规则说明,规则说明">规则</span></h3>
  <div class="card-body">
    <img class="cover" src="https://picsum.photos/600/300?random=1">
  </div>
</div>

<div class="card-wrapper">
  <div class="card visible">
    <h3 class="card-title">Card Title <span data-title="规则说明,规则说明,规则说明">规则</span></h3>
    <div class="card-body">
      <img class="clip" src="https://picsum.photos/600/300?random=2">
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;
  font-family: "Exo", Arial, sans-serif;
  background-color: #557;
  color: #fff;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
  padding: 3vw;
  place-content: center;
  overflow-x: hidden;
}

.card {
  border: 1px solid #eee;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.45);
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  padding: 5px;
}
.card.hidden {
  position: relative;
}
.card img {
  max-width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center;
}

.card-wrapper {
  position: relative;
  width: 100%;
}

.card-title {
  border-bottom: 1px dotted;
  padding: 10px 2vw;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}
.card-title span {
  margin-left: auto;
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 12px;
  color: #fff;
  background: #000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: absolute;
  right: 0.5vw;
}
.card-title span::before,
.card-title span::after {
  content: "";
  position: absolute;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.card-title span::before {
  content: attr(data-title);
  white-space: nowrap;
  padding: 5px;
  background: #f36;
  border-radius: 4px;
  left: 50%;
  transform: translate(-50%, 0);
  bottom: calc(100% + 8px);
}
.card-title span::after {
  width: 8px;
  height: 8px;
  background: #f36;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translate(-50%, 0) rotate(45deg);
}
.card-title span:hover::before,
.card-title span:hover::after {
  opacity: 1;
  transition: opacity 0.28s ease;
}

              
            
!

JS

              
                
              
            
!
999px

Console