为什么文本"help"不可见,div(class=main)的蓝色边框不可见,div(class=head)的红色边框不可见?


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lost and Found</title>
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Anton&display=swap" rel="stylesheet">
</head>
<body>
<div class="nav" >
<img src="img.png" alt="logo" srcset="">
<div class="b"><span>Electronincs</span></div>
<div class="b"><span>Plastics</span></div>
<div class="b"><span>Wearables</span></div>
<div class="b"><span>Others</span></div>
<input id="srch" type="search" value="Search">
</div>
<div class="main">
<div class="head">
<p>Help</p>
</div>


</div>

</body>
</html>
*{
margin: 0px;
padding: 0px;
}
.nav{
background-color:bisque;
width: 100%;
height: 60px;
display: flex; 
align-items: center;
position: fixed;
}
.b{
height: 60px;
width: 10%;
background-color: antiquewhite;
margin: 2px;
justify-content: center;
font-family: 'Anton', sans-serif;
border-radius: 20px;
align-items: center;
display: flex;
}
img{
width: 80px;
height: 60px;
}
#srch{
width: 10%;
height:60px;
right: 0%;
position:fixed;
font-size: larger;
}
.main{
height: 1000px;
width: 100%;
border-color: blue;
background-color:lightgoldenrodyellow;
}
.head{
width: 100%;
height: 554px;
border-color:red ;
}

为什么文本";帮助;不可见,div(class=main(的蓝色边框不可见,而div(class=head(的红色边框不可见?

我是一个尝试学习网络开发的初学者。我已经成功地创建了固定的导航栏,并且正在努力制作一个占据50%宽度的方框(将在剩余的50%中放置一个图像(。

为什么文本"帮助;不可见

因为它被导航窗格覆盖,您给了它position: fixed

为什么。。。div(class=main(的蓝色边框不可见,div(class=head(的红色边框不可见?

因为您没有设置边框样式。例如,添加border-style: solid;

哪里是"帮助;它在导航栏下,因为你设置它修复

我的";"边界";你只设置了颜色,但没有设置他的风格,你可以使用边界来设置中的所有内容

border: 1px solid blue;

关于你的网页布局,你可以通过只更改css 来使用简单的布局

.nav {
background-color: bisque;
width: 100%;
height: 60px;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0;
}
.main {
padding-top:60px;
height: 100%;
width: 100%;
border-color: blue;
border-style: solid;
background-color: lightgoldenrodyellow;
border: 1px
}

通过像以前一样设置fixed并设置主要内容的边界来跳过导航栏下的一些内容,您也可以设置高度:100%!

为什么文本"帮助;不可见,

因为它在你的导航栏下面

.main{
padding-top: 60px;
}
/* or alternatively */
.head {
margin-top: 60px;
}

div(class=main(的蓝色边框不可见,div(class=head(的红色边框不可见?

您需要设置边框宽度和样式以及颜色

.main {
border: 1px solid blue;
}
.head{
border: 1px solid red ;
}

此外,你似乎在复制和粘贴这行时犯了一个错误:

<link href="<link rel="preconnect" href="https://fonts.googleapis.com">