
Now coming to the main point the element we are using here is @media screen. So first discuss about its conditions and properties
- @media screen and (max-width: 720px)
- @media screen and (min-width: 720px)
- @media screen and (max-height: 720px)
- @media screen and (min-height: 720px)
So it can be used both by using max and min conditions. But never try to use both at a time in your website, it will produce error and will not work properly at all. You can also use a combination of above conditions like
- @media screen and (max-width: 720px; max-height:420px;)
Syntax of @media screen
.class
{
background:#444; color:white; width:1280px;
}
@media screen and (max-width: 720px)
{
.class {background:#444; color:white; width:720px;}
}
So in above code if width is less than 720px than class in @media screen will come into play while without @media screen class will be loaded if screen width is more than 720px.