汉堡图标没有显示



我创建了一个网站,并尝试进行响应式设计。我在youtube上关注视频,并按照视频中的内容做任何事情,但我没有看到汉堡图标。你知道为什么吗?它在视频中效果很好。以下是我的代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nikolinart</title>
<link rel="stylesheet" href="./styles/style.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<nav class="navbar">
<div class="max-width">
<div class="logo"><a href="#">Nikolin<span>art</span></a></div>
<ul class="menu">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Contact</a></li>
</ul>
<div class="menu-btn">
<i class="fas fa-bars"></i>
</div>
</div>
</nav>
<section class="home" id="home">
<div class="max-width">
<div class="home-content">
<div class="text-1">Hello and welcome to</div>
<div class="text-2">Nikolin<span>art</span></div>
<div class="text-3">My name is Nikolina and I'm a <span>Painter</span></div>
</div>
</div>
</section>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Inventore aperiam rem laboriosam corrupti sunt, aspernatur doloremque ipsum molestiae, eveniet debitis vitae tempore ea molestias atque fugiat hic voluptas dignissimos mollitia quasi earum saepe fuga cum. Vero quia blanditiis voluptatum suscipit consequuntur praesentium odit asperiores totam quod, aliquid esse voluptas voluptatem dolorum! Dolor provident, sint repellat esse voluptates facere, dolorem tempora, libero at voluptas repellendus saepe reprehenderit laudantium dicta quas id aliquid corporis. Vitae, perferendis dolores! Explicabo voluptatum officiis vel exercitationem voluptate voluptatem in qui expedita ullam voluptas doloremque modi, ratione iure assumenda nostrum architecto ipsa, minima est corporis sed consequuntur, ipsam corrupti? Ipsam fugit fuga quia tempora ut beatae aperiam impedit iste nostrum consequuntur delectus esse dignissimos, minima placeat sunt possimus. Dolor aperiam beatae id, dignissimos voluptatem vero? Dignissimos illum iste fuga quo at repellendus, recusandae itaque minima accusantium dolorem debitis voluptatem id sint facilis, odit quos aut architecto nemo atque distinctio quaerat error. Deserunt maiores dolorum distinctio placeat fugiat consectetur ipsa facilis quam, saepe ea voluptas esse est ullam itaque sapiente quidem hic. Adipisci facere minima eaque natus sapiente officiis totam magnam consectetur doloribus, consequuntur quis dolorem corporis harum blanditiis mollitia iusto molestiae repellendus quia error, neque fuga praesentium!</p>
<script src="./script/script.js"></script>
</body>
</html> 
.menu-btn {
color: #fff;
font-size: 23px;
cursor: pointer;
display: none;
}

两个可能的原因:

您设置了使文本隐藏的display:none,或者您意外使用了color:#fff(白色(并与background具有相同的颜色

此外,你甚至没有它的内容。

.menu-btn {
color:red;
font-size: 23px;
cursor: pointer;  
}
<div class="menu-btn">
<i class="fas fa-bars">Yes</i>
</div>

display:none隐藏元素你需要删除那行css

在CSS属性中,display属性为None,用于隐藏元素。将类更改为

.menu-btn {
color: #fff;
font-size: 23px;
cursor: pointer;
}

此外,我看到你使用了字体真棒图标,但你没有导入它们,请确保正确导入它们。如果您使用CDN加载Font Awesome,请确保在HTML的HEAD标记中添加必要的导入。

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

相关内容

  • 没有找到相关文章

最新更新