03.媒体查询.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. /*
  10. 媒体特性
  11. width 视口的宽度
  12. height 视口的高度
  13. min-width 视口的最小宽度(视口大于指定宽度时生效)
  14. max-width 视口的最大宽度(视口小于指定宽度时生效)
  15. */
  16. /* @media (max-width:600px){
  17. body{
  18. background-color:#bfa;
  19. }
  20. } */
  21. /*
  22. 样式切换的分界点,我们称其为断点,也就是网页的样式会在这个点时发生变化
  23. 一般比较常用的断点
  24. 小于768 超小屏幕 max-width = 768px
  25. 大于768 小屏幕 min-width = 768px
  26. 大于992 中型屏幕 min-width = 992px
  27. 大于1200 大屏幕 min-width = 1200px
  28. */
  29. /* @media(min-width:500px){
  30. body{
  31. background-color: #bfa;
  32. }
  33. } */
  34. /* @media (min-width:500px) and (max-width:700px){
  35. body{
  36. background-color: #bfa;
  37. }
  38. } */
  39. @media only screen and (min-width:500px) and (max-width:700px){
  40. body{
  41. background-color: #bfa;
  42. }
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. </body>
  48. </html>