<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <style> .foo { width: 1200px; height: 400px; background: #ccc; margin: 20px auto; } /*如果连续的min-with,那么两者之间就可以构成一个范围()*/ /* * [500,900), [900,1200), [1200,?) */ @media screen and (min-width: 500px) { .foo { width: 200px; } } @media screen and (min-width: 900px) { .foo { width: 600px; } } @media screen and (min-width: 1200px) { .foo { width: 1000px; } } </style> </head> <body> <div class="foo"></div> </body> </html>
时间: 2024-10-10 16:28:16