Issue
As shown in the image I have 4 divisions and need to add view-more floating button on image-4 (center of div). how can I do it using HTML & CSS
Note: I need a solution like this:
Code:
<div class="container">
<div>
<img> 1 </img>
</div>
<div>
<img> 2 </img>
</div>
<div>
<img> 3 </img>
</div>
<div>
<img> 4 </img>
</div>
</div>
Solution
/* CSS */
.container {
width: 500px;
display: grid;
grid-template-columns: auto auto;
grid-gap: 20px;
}
img {
width: 100%;
}
.demo {
position: relative;
}
.demo button {
cursor: pointer;
background-color: rgb(0, 0, 0, 0.5);
color: white;
font-weight: bold;
padding: 5px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<!--HTML-->
<div class="container">
<div>
<img src="https://s4.uupload.ir/files/1-6-5_ssnb.jpg" />
</div>
<div>
<img src="https://s4.uupload.ir/files/1-6-5_ssnb.jpg" />
</div>
<div>
<img src="https://s4.uupload.ir/files/1-6-5_ssnb.jpg" />
</div>
<div class="demo">
<img src="https://s4.uupload.ir/files/1-6-5_ssnb.jpg" />
<button>View-more</button>
</div>
</div>
Answered By - Arman Ebrahimi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.