如果我将浏览器大小更改为小于 500 像素,mobile-lounge.css 应该链接(为了测试我在 mobile-lounge 中将 body-background 更改为黑色)。
<head>
<meta charset="utf-8">
<title>Head First Lounge</title>
<link type="text/css" rel="stylesheet" href="lounge.css" media="screen and (min-width: 500px)">
<link type="text/css" rel="stylesheet" href="lounge-mobile.css" media="screen and (max-width: 499px)">
<link type="text/css" rel="stylesheet" href="lounge-print.css" media="print">
</head>
最佳答案
我认为下面的代码会帮助你 CSS 链接会有所帮助,
<link rel="stylesheet" media='screen and (min-width: 201px) and (max-width: 500px)' href="lounge-mobile.css">
关于html - 当我减小浏览器大小时,为什么 "lounge-mobile.css"样式表没有链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57427749/