我有一个问题,html 不会为小屏幕加载 css。 我已经使其他 css 加载没有问题。那些有效的有背景图像,但一个用于宽度小于 500 像素的小屏幕却没有。它只有背景颜色。我试图将图像缩放到 500px 并在 small.css 中添加为背景图像并且它有效但我不会这样做。 请帮忙。 这是 html 代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, maximum-scale=1.0, minimum- scale=1.0, initial-scale=1.0" />
<title>PROCYCLING | MTB klub</title>
<link rel="stylesheet" type="text/css" href="mainstyle.css" />
<link rel="stylesheet" type="text/css" media="only screen and (min-width:801px) and (max-width:1024px)" href="large.css" />
<link rel="stylesheet" type="text/css" media="only screen and (min-width:501px) and (max-width:800px)" href="medium.css" />
<link rel="stylesheet" type="text/css" media="only screen and (min-width: 50px) and (max-width:500px)" href="small.css" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
</body>
这是没有背景图片的 CSS:
@charset "UTF-8";
/* Small Content Formatting */
body{
color:#6fe123;
line-height:1.5em;
font-family: Myriad Pro, Arial, Verdana;
font-size: 14px;
background-color: #2a2a2a;
}
最佳答案
我倒过来理解这个问题。我认为它没有在应该显示图像的时候显示图像。 问题是它显示是因为另一个 CSS 文件,它不应该显示。
在这种情况下,最好明确告诉 CSS 不要使用背景图片:
背景图像:无;
关于html 不会为小屏幕加载 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17133258/