In this Tutorial, we'll build a Responsive Cards UI Layout with Hover Effect using HTML & CSS. This Project-based Tutorial is suitable for all especially Beginners.
HTML
Before we start writing code first, we need to create a primary structure of the HTML document, so that the browser can understand and start working. The basic HTML structure looks like the following.
After writing the primary structure of the HTML document, you will also write the tags and content you need. After that, you can see the output in your browser. We know that HTML Sudu Mae is used for exposing content in a basic format. To complete our content we need to use CSS, which is an HTML insert and it creates an engaging user interface.
<!DOCTYPE html>
<html>
<head>
<title>Creatr Card Design</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="main-container">
<div class="card">
<div class="icon">
<img src="img.jpg">
</div>
<h1>Easy Coding</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris
consequat. deserunt mollit .</p>
<button class="btn">Read More</button>
</div>
</div>
</body>
</html>
CSS
Now, we have time to improve the HTML content, for that, we need to add CSS to the HTML file. CSS can be added to HTML documents in a total of three ways, here we are using outside CSS design using CSS will arrive here after typing and see the output in your browser.*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
background-color: #000;
}
.main-container{
position: relative;
min-height: 100vh;
width: 100vw;
overflow: hidden;
}
.card{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
flex-direction: column;
align-items: center;
max-width: 350px;
padding: 2.2rem 2.3rem;
border-radius: 30px;
background-color: #bfbfbf;
}
.icon{
width: 130px;
height: 130px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
background:black;
}
img{
width: 90px;
border-radius: 50%
}
h1{
color: #003fff;
font-size: 2rem;
text-transform:uppercase;
font-family: monospace;
font-weight: 400px;
margin: .7rem
}
p{
color: black;
font-size: 18px;
font-family: sans-serif;
line-height: 22px;
}
.btn{
background:none;
border:none;
outline: none;
cursor: pointer;
text-transform: uppercase;
font-size: 16px;
font-family: sans-serif;
color: black;
width: 180px;
height: 50px;
border-radius: 25px;
align-self: flex-start;
align-self: flex-start;
box-shadow: -9px -9px 9px 0 rgba(255, 255, 255, 0.4),
9px 9px 9px 0 rgba(0, 0, 0, 0.05);
}
.btn:hover{
box-shadow: inset -9px -9px 9px 0 rgba(255,255,255,0.4),
inset 9px 9px 9px 0 rgba(0,0,0,0.05);
color: red;
}
Image:Dwonload
No comments: