gpt4 book ai didi

html - 水平导航保持垂直显示

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

我正在处理 PSD to HTML5/CSS3 Udemy 上的类(class),我的结果没有像截屏视频中显示的那样呈现。如果 SO 不需要 10 的代表,我会发布比较屏幕截图,但基本上作者的版本水平呈现列表项,没有元素符号,而我的版本保持垂直呈现,有元素符号。

HTML:

<html>
<head>
<title>My Website</title>
<link href="styles/normalize.css" rel="stylesheet" type="text/css" media="screen">
<link href="styles/style.css" rel="stylesheet" type="text/css" media="screen">
</head>
<body>
<header>
<div class="container clearfix">
<a href="/" title="Return to Home" id="logo">
<img src="images/logo.gif" alt="Logo">
</a>
<nav>
<ul>
<li><a href="">About</a>
</li>
<li><a href="">Services</a>
</li>
<li><a href="">Contact</a>
</li>
</ul>
</nav>
</div>
<!-- end container -->
</header>
</body>
</html>

CSS:

/* Navigation Styling */

nav ul {
margin: 0;
padding: 0;
float: right;
}
nav ui li {
list-style: none;
float: right;
}
header nav ul li a {
display: block;
color: #fff;
text-decoration: none;
font-weight: bold;
padding: 20px;
border-left: solid 1px #333;
}
.clearfix:before, .clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
zoom: 1; /* For IE6/7 (trigger hasLayout) */
}

我尝试将 header nav ul li a 中的 display 切换为 inline,这对于水平列表来说似乎更符合逻辑,但这并没有改变任何东西。有什么想法吗?

最佳答案

您的 css 中存在语法错误,只需将 nav ui li 替换为 nav ul li

关于html - 水平导航保持垂直显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26949426/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com