gpt4 book ai didi

html - 为什么我的 ul CSS 在 IE 中工作但在 Chrome 中不工作?

转载 作者:行者123 更新时间:2023-11-28 00:46:41 25 4
gpt4 key购买 nike

正如标题所说;这似乎在 Internet Explorer 上运行良好,但在 Chrome 上却不行(格式没有显示在 Chrome 上,只是很简单,就好像没有应用 CSS 一样)。我不确定为什么,因为如果我将 css 直接放在 html 中的 head 标记内似乎工作正常(但是出于其他原因我需要它在 CSS 中)。

任何帮助将不胜感激:)

这是我的 html 中的一个片段:

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="newcss.css">
</head>
<body>

<ul class="sidenav">
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>

这是我的 CSS 中的一个片段:

ul.sidenav {
list-style-type: none;
margin: 0;
padding: 0;
width: 25%;
background-color: #f1f1f1;
position: fixed;
height: 100%;
overflow: auto;
}

ul.sidenav li a {
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}

ul.sidenav li a.active {
background-color: #4CAF50;
color: white;
}

ul.sidenav li a:hover:not(.active) {
background-color: #555;
color: white;
}

div.content {
margin-left: 25%;
padding: 1px 16px;
height: 1000px;
}

@media screen and (max-width: 900px) {
ul.sidenav {
width: 100%;
height: auto;
position: relative;
}
ul.sidenav li a {
float: left;
padding: 15px;
}
div.content {margin-left: 0;}
}

@media screen and (max-width: 400px) {
ul.sidenav li a {
text-align: center;
float: none;
}
}

最佳答案

所以不确定为什么会发生这种情况,但我卸载然后重新安装了 Chrome,它能正常工作吗?

好吧

关于html - 为什么我的 ul CSS 在 IE 中工作但在 Chrome 中不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53491184/

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