gpt4 book ai didi

html - 在创建响应式导航栏时遇到问题

转载 作者:行者123 更新时间:2023-11-28 03:13:16 25 4
gpt4 key购买 nike

无法使导航栏响应。由于所需的设计,我使用了两个 ul,中间有一个图像。由于 li 填充,这会导致断点以较大的尺寸出现。我想将 Logo 向左移动并添加一个下拉按钮以显示导航栏选项,同时删除移动显示宽度的顶部栏。任何帮助将不胜感激,谢谢。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scalisi Skincare</title>
<link rel="stylesheet" type="text/css" href="build/css/styles.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
<header>
<div class="topbar">
<a href="#">GIVE $10, GET $10</a>
<a href="#">FREE SHIPPING AND FREE RETURNS ON ORDERS OVER $50+</a>
<a class="right" href="#">MY ACCOUNT</a>
</div>
<nav>
<ul class="firstNavSection">
<li><a href="#">BOB'S CREAM</a></li>
<li><a href="#">SCALISI SKINCARE</a></li>
<li><a href="#">TINTED</a></li>
</ul>
<a href="#"><img src="assets/logo.PNG" alt="SCALISI"></a>
<ul class="secondNavSection">
<li><a href="#">REVIEW</a></li>
<li><a href="#">ABOUT</a></li>
<li><a href="#">BLOG</a></li>
<li><a href="#"><i class="fa fa-search fa-2x" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-shopping-bag fa-2x" aria-hidden="true"></i></a></li>
</ul>
</nav>
</header>

</body>
</html>
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}

header {
.topbar {
display: flex;
justify-content: space-between;
background: #7C8DC0;
padding: 8px 100px;
a {
text-decoration: none;
color: white;
flex: 1;
font-family: calibri;
font-size: 1em;
}
.right {
text-align: right;
}
}
nav {
border: 1px solid #dae3e5;
.firstNavSection {
display: inline-block;
position: relative;
top: -10px;
li {
display: inline-block;
list-style: none;
padding: 0 60px;
a {
font-family: calibri;
font-size: 1.5em;
text-decoration: none;
color: black;
}
}
}
a {
img {
display: inline-block;
position: relative;
top: 10px;
}
}
.secondNavSection {
display: inline-block;
position: relative;
top: -10px;
li{
display: inline-block;
list-style: none;
padding: 0 60px;
a {
font-family: calibri;
font-size: 1.5em;
text-decoration: none;
color: black;
i {
color: #7C8DC0;
}
}
}
}
}
}

最佳答案

也许您应该遵循 Bootstrap 的样板文件并且不要忘记添加它的资源。

关于html - 在创建响应式导航栏时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45602851/

25 4 0