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

              
                <html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Animated Profile Card</title>
  <script src="https://kit.fontawesome.com/0a8c7b785d.js" crossorigin="anonymous"></script>
  <link rel="stylesheet" href="style.css" />
  <link rel="stylesheet" href="https://googleapis.com/css?family=Cutive+Mono&family=Poppins:wght@100;200;300;400;500;600;700&display=swap" />
</head>

<body>
  <div class="modal">
    <img src="img.JPG" alt="" />
    <div class="close"></div>
  </div>
  <div class="container">
    <div class="card">
      <div class="header">
        <div class="hamburger-menu">
          <div class="center"></div>
        </div>
        <a href="#" class="mail">
          <i class="far fa-envelope"></i>
        </a>
        <div class="main">
          <div class="image">
            <div class="hover">
              <i class="fas fa-camera fa-2x"></i>
            </div>
          </div>
          <h3 class="name">Ali Ataie</h3>
          <h3 class="sub-name">@itsaliataie</h3>
        </div>
      </div>
      <div class="content">
        <div class="left">
          <div class="about-container">
            <h3 class="title">About</h3>
            <p class="text">
              An aspiring Frontend Developer working with CSS
              / JavaScript / React
            </p>
          </div>
          <div class="icons-container">
            <a href="#" class="icon">
              <i class="fab fa-facebook"></i>
            </a>
            <a href="#" class="icon">
              <i class="fab fa-instagram"></i>
            </a>
            <a href="#" class="icon">
              <i class="fab fa-google-plus-g"></i>
            </a>
            <a href="#" class="icon">
              <i class="fab fa-twitter"></i>
            </a>
          </div>
          <div class="buttons-wrap">
            <div class="follow-wrap">
              <a href="#" class="follow">Follow</a>
            </div>
            <div class="share-wrap">
              <a href="#" class="share">Share</a>
            </div>
          </div>
        </div>
        <div class="right">
          <div>
            <h3 class="number">91</h3>
            <h3 class="number-title">Posts</h3>
          </div>
          <div>
            <h3 class="number">2.4K</h3>
            <h3 class="number-title">Following</h3>
          </div>
          <div>
            <h3 class="number">4.7K</h3>
            <h3 class="number-title">Followers</h3>
          </div>
        </div>
      </div>
    </div>
  </div>
  <script src="main.js"></script>
</body>

</html>
              
            
!

CSS

              
                * {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background-color: #efefef;
}

.container {
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.card {
  position: relative;
  width: 400px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 5px 15px 1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 270px;
  top: 0;
  left: 0;
  background-image: linear-gradient(to top, #00f2fe, #4facfe);
  clip-path: circle(400px at 50% -48.5%);
}

.header {
  position: relative;
  height: 265px;
}

.mail {
  position: absolute;
  top: 1rem;
  right: 2rem;
  font-size: 1.5rem;
  color: #fff;
  opacity: 0.8;
  transition: 0.3s;
  z-index: 3;
}

.mail:hover {
  opacity: 1;
}

.hamburger-menu {
  position: absolute;
  width: 21px;
  height: 16px;
  top: 1.4rem;
  left: 1.9rem;
  z-index: 3;
  cursor: pointer;
  transition: 0.3s;
  opacity: 0.8;
}

.hamburger-menu:hover {
  opacity: 1;
}

.hamburger-menu .center {
  position: absolute;
  height: 2px;
  width: 70%;
  top: 50%;
  transform: translateY(-50%);
  background-color: #fff;
  border-radius: 1px;
}

.hamburger-menu::before,
.hamburger-menu::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background-color: #fff;
}

.hamburger-menu::before {
  top: 0;
}

.hamburger-menu::after {
  bottom: 0;
}

.main {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.main .image {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: url("https://www.rd.com/wp-content/uploads/2017/09/01-shutterstock_476340928-Irina-Bg.jpg")
    no-repeat center/cover;
  border: 4px solid #00d8fe;
  margin-bottom: 2px;
  overflow: hidden;
  cursor: pointer;
}

.image .hover {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: rgba(79, 172, 254, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  transition: 0.5s;
  opacity: 0;
}

.image:hover .hover {
  opacity: 1;
}

.hover.active {
  opacity: 1;
}

.name {
  font-size: 1.2rem;
  color: #fff;
  font-weight: 500;
  line-height: 1;
  margin: 5px 0;
}

.sub-name {
  font-family: "Cutive Mono", monospace;
  font-size: 1.2rem;
  opacity: 0.8;
  color: #fff;
}

.content {
  display: flex;
  padding: 1.7rem 2.5rem 2.6rem 2.5rem;
}

.right {
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  text-align: right;
  align-items: flex-end;
  justify-content: space-between;
  margin-left: 2.1rem;
}

.number {
  font-size: 2.1rem;
  font-weight: 200;
  color: #333;
  line-height: 1.2;
}

.number-title {
  font-size: 0.55rem;
  color: #666;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.title {
  position: relative;
  color: #555;
  font-weight: 500;
  font-size: 1.1rem;
  padding: 0 0 3px 0;
  margin-bottom: 0.9rem;
  display: inline-block;
}

.title::after {
  content: "";
  position: absolute;
  height: 3px;
  width: 50%;
  background-color: #555;
  bottom: 0;
  left: 0;
}

.text {
  color: #666;
  font-weight: 300;
  line-height: 1.7;
}

.icons-container {
  padding: 1rem 0;
}

.icon {
  color: #c4c4c4;
  font-size: 1.3rem;
  text-decoration: none;
  margin-right: 8px;
  transition: 0.3s;
}

.icon:hover {
  color: #4facfe;
}

.buttons-wrap {
  display: flex;
  margin-top: 5px;
}

.follow-wrap,
.share-wrap {
  flex: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.5s;
}

.follow-wrap:hover,
.share-wrap:hover {
  flex: 5;
}

.follow {
  padding: 9.6px 0;
  width: 100%;
  background: linear-gradient(to right, #4facfe 0%, #00f2fe 140%);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 18.1px;
  margin-right: 3px;
}

.share {
  padding: 7.6px 0;
  width: 100%;
  border: 2px solid #4facfe;
  color: #4facfe;
  text-decoration: none;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-left: 3px;
  border-radius: 18.1px;
}

.modal {
  position: fixed;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: -1;
  opacity: 0;
  transition: 0.5s;
}

.modal img {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  max-width: 100%;
  max-height: 100%;
  transition: 0.5s;
}

.modal.show {
  opacity: 1;
  z-index: 99;
}

.modal.show img {
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
}

.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: 0.3s;
}

.close:hover {
  opacity: 0.5;
}

.close::before,
.close::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 3px;
  border-radius: 1.5px;
  top: 50%;
  left: 50%;
  background-color: #fff;
}

.close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close::after {
  transform: translate(-50%, -50%) rotate(135deg);
}

@media (max-width: 410px) {
  .content {
    flex-direction: column;
  }

  .right {
    flex-direction: row;
    text-align: center;
    justify-content: space-around;
    align-items: center;
    margin: 0;
  }
}

@media (max-width: 370px) {
  .header {
    height: 230px;
  }

  .card::before {
    clip-path: circle(400px at 50% -74.5%);
    height: 230px;
  }

  .hamburger-menu {
    width: 16px;
    height: 12px;
    top: 1.1rem;
    left: 1.5rem;
  }

  .mail {
    font-size: 1.1rem;
    top: 0.75rem;
    right: 1.5rem;
  }

  .main .image {
    width: 90px;
    height: 90px;
    border-width: 3px;
  }

  .name,
  .sub-name {
    font-size: 1rem;
  }

  .content {
    padding: 1.2rem 1.8rem 1.8rem 1.8rem;
  }

  .number {
    font-size: 1.8rem;
  }

  .number-title {
    font-size: 0.4rem;
  }

  .right {
    padding-top: 1rem;
  }

  .title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .text {
    font-size: 0.8rem;
  }

  .icons-container {
    padding: 0.5rem 0;
  }

  .icon {
    font-size: 1.1rem;
  }

  .follow {
    padding: 7.6px 0;
    border-radius: 14.6px;
    font-size: 0.6rem;
  }

  .share {
    padding: 5.6px 0;
    border-radius: 14.6px;
    font-size: 0.6rem;
  }
}

              
            
!

JS

              
                const image = document.querySelector(".image");
const hover = document.querySelector(".hover");
const modal = document.querySelector(".modal");
const close = document.querySelector(".close");

function show() {
  hover.classList.add("active");
  modal.classList.add("show");
}

function hide() {
  hover.classList.remove("active");
  modal.classList.remove("show");
}

image.addEventListener("click", show);
close.addEventListener("click", hide);

              
            
!
999px

Console