为什么媒体查询不适用于媒体功能最大宽度?
Why is Media-Query not working with media-feature max-width?
我已将最大宽度添加为媒体功能,但当宽度小于 300 像素时颜色没有变化。我正在通过笔记本电脑上的 Inspect element 检查它。我还调了它的响应度,大小是 100%。请帮忙
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Media Query</title>
<style>
@media screen and(max-width:300px){
body{
color:aqua;
background-color:darksalmon;
}
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Magni cupiditate, adipisci consequatur aliquam modi quo earum maxime ea impedit vitae obcaecati voluptatum. Adipisci repudiandae, officiis laborum itaque eum totam error.</p>
<br>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam minus asperiores iste ratione aut autem laudantium aliquid, deleniti nostrum, delectus exercitationem, corrupti distinctio fugit commodi odio. Dolorem rem sunt temporibus!</p>
</body>
</html>
这行有错字。 space 之前(最大宽度:300 像素)
@media 屏幕和 (max-width:300px)
我已将最大宽度添加为媒体功能,但当宽度小于 300 像素时颜色没有变化。我正在通过笔记本电脑上的 Inspect element 检查它。我还调了它的响应度,大小是 100%。请帮忙
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Media Query</title>
<style>
@media screen and(max-width:300px){
body{
color:aqua;
background-color:darksalmon;
}
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Magni cupiditate, adipisci consequatur aliquam modi quo earum maxime ea impedit vitae obcaecati voluptatum. Adipisci repudiandae, officiis laborum itaque eum totam error.</p>
<br>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam minus asperiores iste ratione aut autem laudantium aliquid, deleniti nostrum, delectus exercitationem, corrupti distinctio fugit commodi odio. Dolorem rem sunt temporibus!</p>
</body>
</html>
这行有错字。 space 之前(最大宽度:300 像素) @media 屏幕和 (max-width:300px)