在Internet Explorer中不加载CSS [英] CSS does not load in Internet explorer

查看:102
本文介绍了在Internet Explorer中不加载CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在练习HTML和CSS,并做了一些简单的事情,比如改变CSS中背景的颜色。问题是,当我在Internet Explorer(IE 11)中加载页面时,不会显示任何更改。为了进一步测试,我在Goggle Chrome中加载了我的页面,并按预期显示了页面。

这已经发生了几次,我试图确保我删除了Internet Explorer中的缓存,我确定我正在编辑正确的文件,并且CSS样式代码在同一个目录中。我确信我做了Crtl + R / Crtl F5刷新,并且不起作用。但奇怪的是,在过去加载它几次之后,它没有我做任何事情。



这是我想要显示的内容:

>

HTML文件:

 <!DOCTYPE html> 
< html lang =en>
< head>
< meta charset =utf-8>
< title>第12课 - 使用CSS选择器的乐趣< / title>
< link type =text / css =stylesheethref =styles.cssmedia =all>
< / head>
< body>

< h1>页面标题< / h1>

< p> Lorem ipsum dolor坐在美眉身上。 Nunc at aliquet nunc。< / p>

< / body>
< / html>

CSS文件:

  h1 {
font-size:30em;
font-weight:heavy;
font-color:red;
line-height:10px;
}

body {
background-color:red;

字体颜色在h1标签中不会改变(可能是因为它不是如何你这样做),但谷歌浏览器中的背景颜色以及字体的大小发生了变化。在资源管理器中,它仍然是H1标签内容不变的白页。有没有人有任何想法会发生什么?



更新:



截至目前,当我加载我的现在在Internet Explorer 11中它现在有CSS样式的变化,但我什么也没变!我只是再次打开它......任何人都可以解释发生了什么,因为这已经发生了多次

解决方案

,看起来问题是在IE中缓存。



您可以尝试指示浏览器不要缓存一些META关键字,如 pragma expires

 < meta http-equiv =pragmacontent =no-cache/> 
< meta http-equiv =expirescontent = - 1/>

查看本文 - 所以你不想缓存,呵呵?



建议使用此跨浏览器的问题解决方案:

 < meta http-equiv =cache-controlcontent =max-age = 0/> 
< meta http-equiv =cache-controlcontent =no-cache/>
< meta http-equiv =expirescontent =0/>
< meta http-equiv =expirescontent =Tue,01 Jan 01 1:00:00 GMT/>
< meta http-equiv =pragmacontent =no-cache/>

希望这有助于您!


So I am practicing HTML and CSS and doing some simple things like changing the color of the background in CSS. The problem is that when I load the page in Internet Explorer (IE 11) no changes show up. To test this further I loaded my page in Goggle Chrome and it displayed the page as expected.

This has happened a few times and I tried to make sure I deleted the cache in Internet Explorer, I made sure I was editing the right file and that the CSS style code was in the same directory. I made sure I did an Crtl + R / Crtl F5 refresh and it doesn't work. The weird thing though is that after loading it a few times in the past it works without me doing anything else.

Here is what I am trying to display:

HTML FILE:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Lesson 12 - Fun With CSS Selectors</title>
  <link type="text/css" rel="stylesheet" href="styles.css" media="all">
</head>
<body>

<h1>Title of the page</h1>

<p>Lorem ipsum dolor sit amet ultricies. Nunc at aliquet nunc.</p>

</body>
</html>

CSS FILE:

h1{
    font-size: 30em;
    font-weight: heavy;
    font-color: red;
    line-height: 10px;
}

body{
    background-color: red;
}

The font color does not change in the h1 tag (probably because its not how you do it) but the background color changes in Google Chrome as well as the size of the font. In Explorer it remains a white page with the H1 tag content unchanged. Does anyone have any ideas on what could be happening?

UPDATE:

As of now when I load my page now in Internet Explorer 11 it now has the changes from the style CSS, but I changed nothing! I just opened it again... Can anyone explain what is going on, because this has happened multiple times

解决方案

Per your comments, seems as your problem is caching in IE.

You can try instructing the browser not to cache with some META keywords such as pragma and expires.

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1"/>

Take a look at this article - So you don't want to Cache, Huh?

And this question which suggests using this cross-browser solution:

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

Hope this helps!

这篇关于在Internet Explorer中不加载CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆