我目前是一名学习编码的学生。我开始使用 Materialized,但遇到了移动响应问题。导航栏文本来 self 觉得很奇怪的栏。下面我附上了问题的照片和我的 HTM、CSS 代码。我从未在这里发布过问题,所以如果我没有在这里正确发布代码,请原谅我。谢谢! HTML:
`<nav class="nav-extended">
<div class="nav-wrapper cyan darken-1">
<a href ="index.html" class="brand-logo center ">Animal Quiz Games</a>
<a href="#" class="sidenav-trigger" data-target="mobile-links">
<i class="material-icon">menu</i>
</a>
<ul id="nav-mobile" class="left hide-on-med-and-down">
<li><a href="score-board.html">Score Board</a></li>
<li><a href="index.html">Quiz</a></li>
</ul>
</div>
</nav>
<ul class="sidenav" id="mobile-links">
<li><a href="/score-board.html">Score Board</a></li>
<li><a href="index.html">Quiz</a></li>
</ul>`
CSS:
* #box {
border-style: double;
border-color: #00acc1;
border-width: 10px;
padding: 50px;
text-align: center;
background-color: white;
font-weight: bold;
color: #1565c0;
}
html {
font-family: 'Times New Roman', Times, serif;
}
body {
background: no-repeat center fixed
url(https://images.pexels.com/photos/145939/pexels-photo-145939.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260);
background-size: cover;
height: 100vh;
}
.row .col {
float: none;
margin-left: auto;
margin-right: auto;
margin-top: 50px;
}
.timeStyle {
color: #1565c0;
border: double;
border-color: #00acc1;
background: white;
margin-bottom: 20px;
width: 300px;
height: 150px;
text-align: center;
}
p {
font-size: 25px;
}
nav ul a {
font-size: 22px;
}
#choice1,
#choice2,
#choice3,
#choice4 {
display: block;
background-color: #00acc1;
}
@media (max-width: 483px) {
.col {
width: 50%;
margin: 0 auto;
}
}
.sidenav li > a {
font-size: 22px;
background-color: #00acc1;
color: white;
}
h4 {
text-align: center;
}
最佳答案
如果我正确理解了这个问题。标题的宽度迫使文本向下到下一行。我建议右键单击标题,检查元素并将鼠标悬停在负责该元素的 html 上。这应该有助于形象化您的问题。要真正解决问题,您可以调整标题的宽度。
关于javascript - 实现导航栏问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61469265/