Profile Cards in HTML & CSS


Source Code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <div class="card">
    <div class="image">
      <img src="images/ant.jpg" alt="">
    </div>
    <div class="content">
      <div class="profile"></div>
      <img src="images/dot.png" width="35px" class="dot">
      <h1>Morgan Sweeney</h1>
      <p>Ant Collector</p>
      <div class="follow-box">
        <div class="follow">
          <h3>12</h3>
          <p>Followers</p>
        </div>
        <div class="follow">
          <h3>1000</h3>
          <p>Following</p>
        </div>
      </div>
      <button>Follow</button>
      <p class="des">
     Morgan has collected ants since they were six years pld and now has many dozen ants but none inn their pants.
      </p>
    </div>
  </div>
</body>
</html>

style.css

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;700&display=swap');

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

body{
  font-family: 'Poppins', sans-serif;
  height: 100vh;
  width: 100vw;
  background-image: linear-gradient(to right bottom, #ff9daa, #fb86ab, #f16fb3, #df5dc0, #c251d1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card{
  height: 600px;
  width: 350px;
  background-color: #fff;
  border-radius: 20px;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
}
.image{
  width: 100%;
  height: 180px; 
}
.image img{
width: 100%;
height: 100%;
object-fit: cover;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
}
.profile{
  width: 150px;
  height:150px;
  box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
  padding: 15px;
  background: #fff;
  background-image: url('../images/user.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 50%;
  border-radius: 50%;
  position: absolute;
  top: -70px;
  left: 100px;
}

.content{
  width: 100%;
  height: calc(600px - 180px);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: 30px;
}

.dot{
align-self: flex-end;
}
h1{
  color:rgba(51, 51, 51, 0.956);
  font-size: 25px;
  font-weight: 500;
}

h1+p{
  color:darkgray;
  font-size: 13px;
}

.follow-box{
  width: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  text-align: center;
}

button{
  width: 100%;
  height: 50px;
  border: none;
  background-color: #FED01A;
  font-weight: bold;
  border-radius: 25px;
  font-size: 18px;
  color:#333;
  cursor: pointer;
}
.follow h3{
  color:#2D96DD;
  font-size: 30px;
}
.follow p{
  color:darkgray;
}
.des{
  line-height: 20px;
  color:#333;
  text-align: justify;
}

Output

Profile Cards in CSS


Live Preview

To download raw file Click Here