I am having some issues with media queries. They're just not working. I have a pretty blank site right now - it's just one page with one img in it.
This question is related to this one, but is not a duplicate.
In my previous question, I was unable to get the image to center horizonally on the page when the max-width
was 480px
.
The code I was using:
@media (max-width: 480px)
{
img
{
display: block;
margin-left: auto;
margin-right: auto;
}
}
Now, I have managed to solve that - partially - by adding:
<meta name="viewport" content="width=device-width" />
to the head section of the document. But now, on a different phone which has a width of 1280px
, the img still centers! Even though the only style in my CSS specifically says max-width:480px
.
Why is this happening?
I have two phones. One phone is 480px wide and the other is 1280px wide. Why does the img center on the 1280px phone when it shouldn't be?