I tried everything to center the image on the page just for the @media screen and (max-width: 480px), however, nothing works.
The code is as follows:
Front end
<figure class="img1 embed">
<img src="Images/testimonial-2.jpg" alt=""/>
</figure>
CSS
figure.embed,
figure.embed-top,
figure.overlay,
figure.embed-over {
display: inline-block;
vertical-align: top;
position: relative;
margin: 0.5em;
font-size: 0.8em;
background: white;
overflow: hidden;
float: right;
}
figure.embed img,
figure.embed-top img,
figure.overlay img,
figure.embed-over img {
width: 100%;
display: block;
}
figure.embed figcaption,
figure.embed-top figcaption,
figure.overlay figcaption,
figure.embed-over figcaption {
width: 100%;
padding: 0.5em;
color: rgba(50,50,50,1.0);
background: rgba(200,200,200,0.825);
}
Can anyone advise what I need to do for this code so that the image is the center? I tried display: block; margin: 0 auto and margin-left: auto; margin-right: auto, but to no avail.
Any help would be greatly appreciated!
source
share