简体   繁体   English

为什么我的锚标签仍然是蓝色的?

[英]Why the heck are my anchor tags still blue?

 a { color: inherit; text-decoration: none; } * { transition: all 0.3s ease-in-out; } .container { clear: both; overflow: auto; } nav { float: right; } .logo img { float: left; } #navbar li { display: inline-block; padding: 10px; font-size: 20px; font-family: raleway; } #navbar li:hover { color: #FFB500; } #navbar { overflow: auto; }
 <header> <div class="container"> <div class="logo"> <img src="" alt="" width="130" /> </div> <nav> <ul id="navbar"> <li> <a href="index.html">Home</a></li> <li> <a href="menu.html">Menu</a></li> <li> <a href="about.html">About</a></li> <li> <a href="contact.html">Contact</a></li> </ul> </nav> </div> </header>

When I preview the file in chrome, IE and Firefox it looks the way I want it too, Plain black text that changes to orange when hovered over.当我在 chrome、IE 和 Firefox 中预览文件时,它看起来也是我想要的样子,纯黑色文本在悬停时变为橙色。 However when I deploy it to the hosting environment for my school project it ends up just looking blue with the underline and it's ugly.但是,当我将它部署到我的学校项目的托管环境时,它最终看起来只是带有下划线的蓝色,而且很难看。 How do I fix this?我该如何解决?

Please provide CSS specificity (more specific CSS that will have more priority over normal class-based or tag-based CSS), and it will avoid the case of being overridden, please find below example: 请提供CSS特定性(更具体的CSS将比普通的基于类或基于标签的CSS具有更高的优先级),这样可以避免被覆盖的情况,请参见以下示例:

div nav ul li {
   // some css
}
div nav ul li:hover {
 color: #FFB500;
}

And if it still doesn't solve your problem, make sure your CSS is being loaded in the browser, and confirm from browser's developer tool. 如果仍然不能解决您的问题,请确保已将CSS加载到浏览器中,然后从浏览器的开发人员工具中进行确认。

If you write css in html file, there is no reason that the style didn't work.如果您在 html 文件中编写 css,则没有理由认为样式不起作用。 So I guess, you separate css and html file ?所以我想,你把 css 和 html 文件分开了?

Check if you can access the online css file,and is the css being linked to html file correctly.Press F12 in chrome and chenck your css file.检查您是否可以访问在线 css 文件,并且 css 是否正确链接到 html 文件。在 chrome 中按 F12 并检查您的 css 文件。

If you couldn't open online css file, your server may have some problem with static file.如果您无法打开在线 css 文件,您的服务器可能有一些静态文件问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM