I'm trying to apply media queries in a site but my knownledge is not deep in this topic, so basically I want to apply a specific style to a tag when the detected screen is greater than 1024*768.
I did this
@media screen and ( device-width: 1024px ) {
}
but the I've to identify when the resolution is greater than 1024
In my experience, 320px, 768px, and 1200px are the most commonly used; these three values should be sufficient for targeting smart phones, tablets/laptops, and desktops, respectively.
Media query is used to create responsive web design. It means that the view of web page differ from system to system based on screen or media types. screen: It is used to set the screen size of media query. The screen size can be set by using max-width and min-width.
Max-width and min-width can be used together to target a specific range of screen sizes. @media only screen and (max-width: 600px) and (min-width: 400px) {...} The query above will trigger only for screens that are 600-400px wide. This can be used to target specific devices with known widths.
Try this:
@media only screen and (min-width : 1025px) {
.classname {
/* styles here */
}
}
@media only screen and (max-width : 1024px) {
.classname {
/* other styles here */
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With