gpt4 book ai didi

css - Less Css 不适用于 IE8 和 IE7

转载 作者:太空宇宙 更新时间:2023-11-04 04:42:51 26 4
gpt4 key购买 nike

我有疑问,为什么 Less Css 在这两种浏览器上都不起作用(没有应用样式表的页面)?在 IE9+ 上它看起来很正常,就像在 Chrome、FF 和 Opera 上一样。在屏幕上看:

来源 Source代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mansion</title>

<link rel="stylesheet" href="/Content/normalize.css" media="all"/>
<link href='http://fonts.googleapis.com/css?family=Merriweather:400,700,900,300' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<link rel="stylesheet/less" href="/Content/siteHD.less" media="screen and (max-width: 1920px)" />
<link rel="stylesheet/less" href="/Content/site1024.less" media="screen and (max-width: 1024px)" />
<link rel="stylesheet/less" href="/Content/site768.less" media="screen and (max-width: 768px)" />
<link rel="stylesheet/less" href="/Content/site640.less" media="screen and (max-width: 640px)" />
<link rel="stylesheet/less" href="/Content/site320.less" media="screen and (max-width: 320px)" />
</head>
<body>...</body>
</html>



IE10(这里是IE9的样子) IE10

IE8(看最后一个跳过头部的样式) IE8

你看到这里有什么我看不到的错误吗?

最佳答案

您似乎正尝试在您的站点上使用 LESS 文件而不包括 less.js库,需要将您的 LESS 代码转换为浏览器可以理解的 CSS。

下载less.js从页面顶部 lesscss.org ,然后将其包含在您的 </head> 之前标签:

<script src="less.js" type="text/javascript"></script>

显然,您需要将路径更改为您在网站上存储 JS 文件的位置。请注意,此文件将包含在您的样式表之后

您发布的代码示例:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mansion</title>

<link rel="stylesheet" href="/Content/normalize.css" media="all"/>
<link href='http://fonts.googleapis.com/css?family=Merriweather:400,700,900,300' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<link rel="stylesheet/less" href="/Content/siteHD.less" media="screen and (max-width: 1920px)" />
<link rel="stylesheet/less" href="/Content/site1024.less" media="screen and (max-width: 1024px)" />
<link rel="stylesheet/less" href="/Content/site768.less" media="screen and (max-width: 768px)" />
<link rel="stylesheet/less" href="/Content/site640.less" media="screen and (max-width: 640px)" />
<link rel="stylesheet/less" href="/Content/site320.less" media="screen and (max-width: 320px)" />
<script src="less.js" type="text/javascript"></script>
</head>
<body>...</body>
</html>

另一方面,您可能应该看看使用可用的编译器之一将 LESS 代码编译成一个或多个 CSS 文件。查看可用列表 GUI compilers that use LESS .

关于css - Less Css 不适用于 IE8 和 IE7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15080286/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com