Create Card Profile HTML CSS
Preview
Hello guys, this tutorial, I will create a Card Profile that displays photos, names, short descriptions and social media accounts in the form of animation when the pointer is highlighted (Hover).
Now create a project folder and create the index.html and style.css files in it and include one of your photos in a square. When finished, open index.html and enter the following code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Card Profile</title>
<link rel="stylesheet" href="style.css">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet">
</head>
<body>
<div class="card">
<div class="image">
<img src="img.jpg">
</div>
<div class="details">
<div class="center">
<h1>Andi Aspin<br><span>Web Designer</span></h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<ul>
<li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
Then, open style.css and enter the following code
body
{
font-family: sans-serif;
margin: 0;
padding: 0;
background: #282828;
}
.card
{
position: absolute;
border-radius: 10px;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 400px;
height: 400px;
background: #000;
}
.card .image{
border-radius: 10px;
width: 100%;
height: 100%;
overflow: hidden;
}
.card .image img{
width: 100%;
height: 100%;
background-size: cover;
transition: .5s;
}
.card:hover .image img{
opacity: .5;
transform: translateX(30%);
}
.card .details{
position: absolute;
top: 0;
left: 0;
width: 70%;
height: 100%;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
background:#DC143C;
transition: .5s;
transform-origin: left;
transform: perspective(2000px) rotateY(-90deg);
}
.card:hover .details{
transform: perspective(2000px) rotateY(0deg);
}
.card .details .center{
padding: 20px;
text-align: center;
background: #fff;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.card .details .center h1{
margin: 0;
padding: 0;
color: #DC143C;
line-height: 20px;
font-size: 20px;
text-transform: uppercase;
}
.card .details .center h1 span{
font-size: 14px;
color: #262626;
}
.card .details .center h1 p{
margin: 10px 0;
padding: 0;
color: #262626;
}
.card .details .center ul{
margin: 10px auto 0;
padding: 0;
display: table;
}
.card .details .center ul li{
list-style: none;
margin: 0 5px;
float: left;
}
.card .details .center ul li a{
display: block;
background: #262626;
color: #fff;
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
transition: .5s;
}
.card .details .center ul li a:hover{
background: #DC143C;
}
Save all files and run index.html