I am trying to use media query in component's styles, but when I resize the window, nothing is happens
@media query screen and (max-width: 768px) {
/* Here are some changes*/
}
It doesn't work at all, do I need to load some modules or how to fix it. Any help appreciate.
Use following syntax. This is the correct syntax for media query. Hope this helps!!
@media only screen and (max-width: 768px) {
/* Here are some changes*/
}
remove query
@media screen and (max-width: 768px)
{
/* Here are some changes*/
}
You might want to write different media queries for each breakpoint. Also, the syntax is like below
/* Tablet*/
@media screen and (max-width: 768px) {
/* Here are some changes*/
}
/* Mobile */
@media screen and (max-width: 320px) {
/* Here are some changes*/
}
A bit simpler way,
@media (max-width: 768px) {
/* Here are some changes*/
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.