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">

  <div class="card-face front">

  <div class="profile-image">

		<img src="https://assets.codepen.io/285131/neongirl.jpg" />

	</div>

    <h2 class="name">John Doe</h2>

    <p class="intro">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</p>

    <button class="more-info">About More...</button>

    <div class="socials">

      <a href="#"><i class="fab fa-facebook-f"></i></a>

      <a href="#"><i class="fab fa-twitter"></i></a>

      <a href="#"><i class="fab fa-instagram"></i></a>

      <a href="#"><i class="fab fa-github"></i></a>

    </div>

  </div>

  <div class="card-face back">

  <button class="close-btn">X</button>

  <p class="details">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.</p>

</div>

</div>

<div class="buttons">

  <button class="team-member" data-member="john">John Doe</button>

  <button class="team-member" data-member="jane">Jane Doe</button>

  <button class="team-member" data-member="bob">Bob Smith</button>

</div>


              
            
!

CSS

              
                body{

     font-family: 'Ysabeau Infant', sans-serif;

     margin-top: 40px;

}

.card {

  width: 300px;

  height: 550px;

  position: relative;

  perspective: 1000px;

  margin: 0 auto;

  transition: opacity 1s;
}

.profile-image {

	border-radius: 10%;

	overflow: hidden;

	width: 275px;

	height: 275px;

	position: relative;

	img {

		position: absolute;

		top: 50%;

		left: 50%;

		transform: translate(-50%, -50%);

		width: 100%;

	}

}

.card-face {

  width: 100%;

  height: 100%;

  position: absolute;

  backface-visibility: hidden;

  border: 3px solid;

  border-image-source: linear-gradient(45deg, red, yellow, blue);

  border-image-slice: 1;

  display: flex;

  flex-direction: column;

  align-items: center;

  justify-content: space-around;

  padding: 20px;

  box-sizing: border-box;

  font-family: Arial, sans-serif;

  color: #333;

  background: linear-gradient(45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);

  background-size: 500% 500%;

  animation: Gradient 15s ease infinite;

  transition: transform 1s;

}

.front {

  transform: rotateY(0deg);

}

.back {

  transform: rotateY(180deg);

}

.card.is-flipped .front {

  transform: rotateY(-180deg);

}

.card.is-flipped .back {

  transform: rotateY(0deg);

}

.name, .intro, .details {

  text-align: center;

}

.close-btn {

  position: absolute;

  top: 10px;

  right: 10px;

  background: none;

  border: none;

  font-size: 20px;

  cursor: pointer;

}

.more-info {

  padding: 10px 20px;

  border: 1px solid #3498db;

 background-color: transparent;

  color: #333;

  font-size: 1em;

  font-weight: 500;

  cursor: pointer;

  transition: background 0.3s;

  border-image-source: linear-gradient(45deg, green, pink, blue);

  border-image-slice: 1;

  box-shadow: 0 3px 3px rgba(0, 0, 0, 0.6);

}

.more-info:hover {

  background: #86EBAE;

}

.socials{

  margin: 30px 0px 20px 0px;

}

.socials a {

  margin: 0 10px;

  padding: 5px 8px;

  border-radius: 20%;

  color: white;

  background-color: black;

  text-decoration: none;

}

.buttons {

  display: flex;

  justify-content: space-around;

  margin-top: 20px;

}

.team-member {

  padding: 10px 20px;

  border: none;

  color: #333;

  background: #86EBAE;

  cursor: pointer;

  transition: background 0.3s;

}

.team-member:hover {

  background: #ddd;

}

@keyframes Gradient {

  0% {

    background-position: 0% 50%;

  }

  50% {

    background-position: 100% 50%;

  }

  100% {

    background-position: 0% 50%;

  }

}
              
            
!

JS

              
                let card = document.querySelector('.card');
let moreInfoButton = document.querySelector('.more-info');
let teamMemberButtons = document.querySelectorAll('.team-member');

moreInfoButton.addEventListener('click', function() {
  card.classList.toggle('is-flipped');
});

teamMemberButtons.forEach(button => {
  button.addEventListener('click', function() {
    let member = this.dataset.member;
    card.style.opacity = 0;
    setTimeout(() => {
      // Update the card details with the new team member's details
      card.querySelector('.name').textContent = member;
      card.querySelector('.intro').textContent = `A short two-line introduction about ${member}.`;
      card.querySelector('.details').textContent = `More details about ${member}.`;
      if (!card.classList.contains('is-flipped')) {
        // If the card is not flipped, add the fadeInUp animation
        card.classList.remove('animate__fadeOut');
        card.classList.add('animate__fadeIn');
      }
      card.style.opacity = 1;
    }, 1000);
  });
});

teamMemberButtons.forEach(button => {
  button.addEventListener('click', function() {
    /* other code */
    card.classList.remove('is-flipped');
  });
});

teamMemberButtons.forEach(button => {
  button.addEventListener('click', function() {
    /* other code */
    card.classList.add('animate__animated', 'animate__zoomOut');
    setTimeout(() => {
      /* other code */
      card.classList.remove('animate__zoomOut');
      card.classList.add('animate__fadeIn');
    }, 1000);
  });
});

let closeButton = document.querySelector('.close-btn');

closeButton.addEventListener('click', function(e) {
  e.stopPropagation();  // Prevent the click event from bubbling up to the card
  card.classList.remove('is-flipped');
});

              
            
!
999px

Console