【发布时间】:2020-04-17 19:23:24
【问题描述】:
下面是我的代码。我无法在屏幕左上角显示徽标。
我的主要问题是图像没有显示在屏幕上的任何位置,尽管我在图像部分输入了正确的文件名。
如果有人能帮助我,我将不胜感激!提前致谢。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background: url(../img/bg-pattern.png),linear-gradient(to left,#FF6900, orange);
border-radius: 0px;
position: fixed;
top: 0;
width: 100%;
}
li {
float: right;
}
#logo {
float: left;
display: inline-block;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 20px;
margin-right: 20px;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: #F29078;
border-radius: 5px;
}
.active {
background-color: #F29078;
}
.logo {
width: 33px;
height: 67px;
border-radius: 5px;
}
</style>
</head>
<body data-spy="scroll" data-target="#myScrollspy" data-offset="0">
<ul>
<li><img src="imageO.jpg" id="logo" class="logo"/> </li>
<li><a href="#about">About</a></li>
<li><a href="#pathway">Features</a></li>
<li><a href="#implementation">Download</a></li>
</ul>
</div>
</body>
</html>
【问题讨论】:
-
你试过
<img src="../img/imageO.jpg" id="logo" class="logo"/> -
..image0.jpg 是否与 html 文件在同一文件夹中?
-
顺便说一句,我会将
img#logo从li中取出,并将您的ul包装在nav中。而且您不需要float:left和inline-block -
这能回答你的问题吗? How can find the image path for css