I have tried using media query to resize images on my page according to screen-size but it didn't work , need help.
Here is the relevant code of images in my html :
<body>
<div class="img certhtml"></div>
<div class="img certcss"></div>
<div class="img certjs"></div>
<div class="img certphp"></div>
</body>
</html>
Here is the relevant css pertaining to the class:
.img {
width: 836px;
height: 588px;
border: 4px solid #38b6ff;
margin: 5px;
background-size: cover;
background-repeat: no-repeat ;
margin: auto;
}
.certhtml {
background-image: url("images/SW_html5_foundations.png");
}
.certcss {
background-image: url("images/SW_css3_foundations.png");
}
.certjs {
background-image: url("images/SW_javascript_foundations.png");
}
.certphp {
background-image: url("images/SW_php_7_foundations.png");
}
This code allows the images to be seen clearly on full screen ,when screen width goes down below 776px then it buggers up the images.
I tried using
@media and (max width:776px) {
.img{height:60%;width:60%}
}
Tried lots of fiddling about but didn't work
but to no avail, would appreciate help, thanks.