html - 为什么我的导航栏是垂直的而不是水平的
问题描述
我试过改变显示并摆脱一些代码?可能删除了错误的东西或某些代码重叠?我是网络开发的新手,所以如果你能解释我做错了什么,那将非常感谢。查看此 JSFiddle 链接上的代码。https://jsfiddle.net/galbruh/htsrmy0L/2/#&togetherjs=PjjPVg1cOR
.toc-nav {
float: left;
/*list-style: none;*/
margin-top: 2%;
/*margin-left: 10%;
margin-right: 0%;*/
width: 100%;
text-align: center;
}
.toc-nav li {
display: incline;
list-style-type: none;
}
.toc-nav li a {
color: white;
text-decoration: none;
padding: 10px 70px;
font-family: "Roboto", sans-serif;
font-size: 16px;
}
.toc-liv li.active a {
border: 1px solid white;
}
.toc-nav li a:hover {
border: 1px solid white;
}
@media screen and (max-width: 500px) {
.toc-nav li a {
float: left;
/*display: none;*/
width: 100%;
text-align: left;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv='content-type' content='text/html; charset=UTF-8' />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome</title>
<link rel="stylesheet" type="text/css" href="css/mystyle.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="js/classie.js"></script>
<style>
body,html {
height: 100%;
margin: 0;
background-color: #2f3036;
}
b {
color: black;
font-family: "Teodor";
font-size: 25px;
}
.bg {
/* The image used */
background-image: url("images/logo.png");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
label {
color: white;
}
</style>
</head>
<body>
<header id="top"></header>
<nav role="navigation">
<ul class="toc-nav">
<li><a href="#about">About</a></li>
<li><a href="#albums">Albums</a></li>
<li><a href="#music">Music</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<div class="bg"></div>
解决方案
你有一个拼写错误display: incline
,它实际上是拼写的inline
。这解决了它。
推荐阅读
- c# - 错误“需要对象引用”是什么意思?
- javascript - 如何将 Javascript 转换为 jQuery
- ios - 从 HealthKit 获取 Apple Watch 应用程序的心率和步行距离以及计步器
- android - 在回调 viewpager 片段后按时收到此错误您必须先在孩子的父母上调用 removeView()
- c++ - 为什么我的 constexpr 对象不在我的函数中?
- python - 使用固定宽度的列保存数据框
- matlab - 将几个表组合成一个结构表
- java - 如何通过使用程序(Java 代码)运行 Jmeter 测试在 Java 代码中设置 CSV 文件?
- angular - 关闭 - 更改 favicon Angular 主题
- python-3.x - 如何使用类定位特定元素