I have an html element which is an image . There is no problem seeing the image in mobile, but when you look at the page in computer, the image disappears. I found out the reason this element disappears is when I give it a class="ad_img". there is no style for appearing and disappearing this element inside that class. When I remove class="ad_img" the image shows up.
.ad_img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.ad_main_div {
width: 100%;
max-width: 800px;
}
.ad_main_panel {
background-color: rgba(0, 0, 0, 0.00);
border-radius: 3px;
overflow: hidden;
border: 3px solid rgba(0, 0, 0, 0.00);
display: inline-block !important;
position: relative;
object-fit: cover;
margin-top: 5px;
margin-bottom: 5px;
margin-right: auto;
margin-left: auto;
left: 0px;
right: 0px;
min-width: 100%;
max-width: 800px;
padding-bottom: 12.5%;
}
<center>
<div class="ad_main_div">
<p> With class </p>
<button id="ad_main_button" class="ad_main_panel">
<img src="https://pearlcapital.com/wp-content/uploads/2018/04/FB-Phone-GIF.gif" id="ad_main_img" alt="No Image" class="ad_img"/>
</button>
<p> Without class </p>
<button id="ad_main_button" class="ad_main_panel">
<img src="https://pearlcapital.com/wp-content/uploads/2018/04/FB-Phone-GIF.gif" id="ad_main_img" alt="No Image" />
</button>
</div>
</center>
Aucun commentaire:
Enregistrer un commentaire