CSS文件未在浏览器中更新

sqyvllje  于 2023-02-01  发布在  其他
关注(0)|答案(4)|浏览(104)

只是工作的基本编码技能,当我在css文件中进行更改时,更改不会显示在我的浏览器上。
下面是我的index.html代码:

<html>
   <head>
       <link ref="stylesheet" href="css/style.css?v=1.1">
   </head>

<body>
   <div class="ios-switch">
    <div class="switch-body"> 
        <div class="toggle"></div>
    </div>
    <label>iOS Switch Practice</label> 
    <input type="checkbox" name="check box">
</div>
    </body>
</html>

下面是我的style.css文件:

*
{
   margin:0;
   padding:0;
}

.ios-switch{`enter code here`
    display: flex; 
    flex-direction: row; 
    align-items: center;
    margin: 10px 0; 
}

.ios-switch .switch-body{
    background-color: lightgray;
    border: solid 1px gray; 
    width: 96px;
    border-radius: 999px; 
}

.ios-switch .switch-body .toggle{
    width:48px; 
    height:48px;
    background-color: white;
    border-radius: 50%; 
}

最后,当我在网上查找这个问题时,一些人建议去谷歌浏览器中的开发者工具,我注意到有这样的错误信息:
VM25:1047到"ws://本地主机:8125/"的WebSocket连接失败:建立连接出错:网络::错误连接被拒绝
非常感谢你抽出时间。

qhhrdooz

qhhrdooz1#

转到DeveloperTools(F12),然后设置(F1),并在网络首选项检查(禁用缓存(当DevTools打开时)-刷新页面

rqqzpn5f

rqqzpn5f2#

您可以通过按[Ctrl] + [F5](重新加载)来刷新页面以清除其缓存。

cngwdvgl

cngwdvgl3#

@ForestProgramming,没有一个该高速缓存解决方案可以解决这个问题,因为它与您的缓存无关。由于这样或那样的原因,您的Web服务器出现故障。由于您只是使用HTML/CSS,请在浏览器中打开HTML文件,而不是使用localhost。
您可以在文件菜单中执行此操作,然后打开,找到HTML文件并单击它。

fumotvh3

fumotvh34#

你的css文件看起来无效。
尝试从中删除此内容
对于CSS验证,尝试使用验证器here

*
{
   margin:0;
   padding:0;
}

.ios-switch{
    display: flex; 
    flex-direction: row; 
    align-items: center;
    margin: 10px 0; 
}

.ios-switch .switch-body{
    background-color: lightgray;
    border: solid 1px gray; 
    width: 96px;
    border-radius: 999px; 
}

.ios-switch .switch-body .toggle{
    width:48px; 
    height:48px;
    background-color: white;
    border-radius: 50%; 
}

相关问题