为不同尺寸设备设置不同CSS样式规则的媒体查询
原创
为不同的CSS样式规则设置媒体查询,您可以尝试运行以下代码 −
示例
实时演示
<html> <head> <style> body { background-color: lightpink; } @media screen and (max-width: 420px) { body { background-color: lightblue; } } </style> </head> <body> <p>If screen size is less than 420px, then it will show lightblue color, or else it will show light pink color</p> </body> </html>
以上就是为不同尺寸设备设置不同CSS样式规则的媒体查询的详细内容,更多请关注IT视界其它相关文章!
上一篇:如何在 SASS 中将变量设置为不等于任何值? 下一篇:CSS 自我对齐属性