我试图插入我的网页的我的图标不起作用.有人能告诉我插入它需要的代码和样式吗?
<html>
<head>
<title>Welcome to Crash - Login or Signup</title>
<link rel="stylesheet" type="text/css" href="crash_styling.css"></link>
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
</head>
<body link="#336666" alink="red" vlink="red">
<div id="header_title">
<h1 id="title">crash</h1>
<p id="motto">Keep track of all your assignments and projects.</p>
</div>
<form name="input" action="html_form_action.asp" method="get" id="user_passEntry">
Username:<input type="text" name="username" placeholder="Your Username" /> <br />
Password:<input type="password" name="password" placeholder="Your Password" />
<input type="submit" value="submit">
</form>
<p id="description">Crash is a way students can keep track of their projects and assignments on the computer or on their devices. With crash, you can be sure you'll never turn in something late again.</p>
<div class="make"><a href="crash_styling" style="text-decoration:none"/>Make a New Assignment</div>
<div class="edit"><a href="crash_styling" style="text-decoration:none"/>Edit an Assignment</div>
<div class="check"><a href="crash_styling" style="text-decoration:none"/>Check off an Assignment</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Tar*_*ryn 24
要在您的网站上放置Favicon,您可以在<head>
标记中使用以下内容
<link rel="shortcut icon" href="http://yourwebsitepath/favicon.ico" />
Run Code Online (Sandbox Code Playgroud)
您需要确保图标的路径正确.如果路径不正确,则不会出现.我也看到了缓存问题,使得图标似乎无法正常工作.清除缓存后,始终尝试重新启动浏览器.
很可能你的图标路径不好。确认您的文件路径。尝试使用
href="favicon.ico"
Run Code Online (Sandbox Code Playgroud)
代替
href="/favicon.ico"
Run Code Online (Sandbox Code Playgroud)
也许它会起作用。或者,如果您在某个文件夹中有图标,例如在图像中
href="images/favicon.ico"
Run Code Online (Sandbox Code Playgroud)
你做对了,但如果你的路径不好,图标就不会出现。
所以你的CSS
作品,如果你的图标与文件处于同一级别,CSS
那么删除/
它应该可以工作。