I'm currently designing a website using Bootstrap
and FontAwesome
, which involves clickable images and font-awesome elements overlapping. I have devised the following code:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<style>
.tr {
border: none;
}
.ebp_container {
/* Necessary styling */
position: relative;
width: 300px;
margin: 10px;
padding: 20px;
}
.ebp_video {
/* Necessary styling */
position: relative;
z-index: 2;
width: 80px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
color: var(--eniac-blue);
cursor: pointer;
border-radius: 15px;
display: block;
margin-left: auto;
margin-right: auto;
}
.ebp_video:hover {
opacity: 0.9;
}
.ebp_pdf {
position: absolute;
top: 70px;
right: 90px;
z-index: 1;
width: 35px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.ebp_pdf:hover {
opacity: 0.9;
}
.ebp_wrapper {
float: left;
width: 25%;
align-items: center;
}
@media screen and (max-width: 985px) {
[class^="icon-"], [class*=" icon-"] {
display: inline-block;
width: 100%;
}
.ebp_wrapper {
float: none;
margin: auto;
width: 60%;
}
}
</style>
<div class="container" style="margin-top: 50px;">
<div class="ebp_wrapper">
<div class="ebp_container">
<h5 style="margin-bottom: 50px" class="font-weight-bold">Some Text</h5>
<a href="#" target=”_blank”><div class="ebp_pdf far fa-file-pdf fa-3x" style="color: #b3001b"></div></a>
<div><img class="ebp_video" src="eplay.png" data-toggle="modal" data-target="#exampleModal" /></div>
</div>
</div>
<div class="ebp_wrapper">
<div class="ebp_container">
<h5 style="margin-bottom: 50px" class="font-weight-bold">Some Text</h5>
<a href="#"><div class="ebp_pdf far fa-file-pdf fa-3x" style="color: #b3001b"></div></a>
<div><img class="ebp_video" src="eplay.png" data-toggle="modal" data-target="#exampleModal" /></div>
</div>
</div>
<div class="ebp_wrapper">
<div class="ebp_container">
<h5 style="margin-bottom: 50px" class="font-weight-bold">Some Text</h5>
<a href="#"><div class="ebp_pdf far fa-file-pdf fa-3x" style="color: #b3001b"></div></a>
<div><img class="ebp_video" src="eplay.png" data-toggle="modal" data-target="#exampleModal" /></div>
</div>
</div>
<div class="ebp_wrapper">
<div class="ebp_container">
<h5 style="margin-bottom: 50px" class="font-weight-bold">Some Text</h5>
<a href="#"><div class="ebp_pdf far fa-file-pdf fa-3x" style="color: #b3001b"></div></a>
<div><img class="ebp_video" src="eplay.png" data-toggle="modal" data-target="#exampleModal" /></div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
Currently, I am working on making the mobile view responsive with centered images stacked vertically. However, the alignment is off as they are appearing shifted to the right instead of being in the middle.
The buttons in desktop view:
https://i.sstatic.net/zNrh2.png
The buttons in mobile view are not correctly aligned, appearing away from the optimal positioning (The yellow rectangle).
https://i.sstatic.net/RD2GF.png
My question is, how can I properly center these images?
Edit: Initially, I tried using Bootstrap but adjusting the screen size separates the two buttons.