Home > Software engineering >  Media query not changing margin
Media query not changing margin

Time:02-10

I have css that should make the div margin go to 10% if the screen is 1920px wide or less, and 20% margin-left if the screen width is any higher. For some reason though, the media query is not working. Here is the code for it. Thanks!

.about-me-header{
    width: 200px;
    margin-left: 20%;
    height: 20%;
}

@media only screen and (max-width:1920){
    .about-me-header{
        margin-left: 10%;
    }
}

CodePudding user response:

You must specify the type of length. Like 1920px

@media only screen and (max-width:1920px){
    .about-me-header{
        margin-left: 10%;
    }
}
  •  Tags:  
  • Related