Html 滚动条未显示在我的第一个网站文件中

Html 滚动条未显示在我的第一个网站文件中,html,css,web,scrollbar,Html,Css,Web,Scrollbar,我已经研究了许多不同的问题,但找不到解决为什么我的滚动条不显示的方法。 我希望有人能告诉我为什么 <!DOCTYPE html> <style> .btn { background-color: rgb(126, 128, 129); /* Blue background */ border: none; /* Remove borders */ color: rgb(255, 255, 255); /* White text */ p

我已经研究了许多不同的问题,但找不到解决为什么我的滚动条不显示的方法。 我希望有人能告诉我为什么

<!DOCTYPE html>
<style>
  
  
    .btn {
  background-color: rgb(126, 128, 129); /* Blue background */
  border: none; /* Remove borders */
  color: rgb(255, 255, 255); /* White text */
  padding: 12px 16px; /* Some padding */
  font-size: 15px; /* Set a font size */
  cursor: pointer; }/* Mouse pointer on hover */
    .btn:hover {background-color: rgb(172, 172, 172);}
    .btn {float: right}
    img.resize {
        float: left;
  width:285px;
  height:75px;
} 
.topnav {
   
  background-color: rgb(185, 29, 29);
  overflow: auto;
}

.topnav a {
  top: 0px;
  position:fixed;
  color: #f2f2f2;
  text-align: center;
  padding: 0px;
  text-decoration: none;
  font-size: 17px;
}
.topnav2 {
  margin-top:30px; 
  background-color: rgb(255, 255, 255);
  overflow:auto;}
.topnav2 a.active {
    background-color: #4CAF50;
    color: white;}
    .topnav2 a:hover {
  background-color: #ddd;
  color: black;
}
.topnav a.active {
  background-color: #4CAF50;
  color: white;
}
.dropbtn {
background-color: rgb(255, 255, 255);
   border: none;
   color:rgb(126, 128, 129);
   font-size: 14px;

}
.dropdown {
  float: left;
  overflow: auto;
}
.dropdown .dropbtn {
  font-size: 14px;
  border: none;
  outline: none;
  color: rgb(153, 153, 153);
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit; /* Important for vertical align on mobile phones */
  margin: 0; /* Important for vertical align on mobile phones */
}
.dropdown-content a {
  float: none;
  color: rgb(160, 160, 160);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}
.dropdown-content a:hover {
  background-color: #ddd;
}
.dropdown:hover .dropdown-content {
  display: block;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}
.sticky {
    margin-top: 50px;
  position: fixed;
  top: 0;
  width: 100%;
}
.sticky2 {
    margin-top: 15px;
  position: fixed;
  top: 0;
  width: 100%;
}

#search {margin-right: 1px;}

#scrollbar {overflow-y: scroll;
height:100ex;}
</style>

<html>    
<body  id="scrollbar">
  
<title>ILIAS DHfPG</title>
<div class="topnav ; sticky2">
<button class="btn">Anmelden</button>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<button id="search" class="btn"><i class="fa fa-search"></i></button>
</div>
<div class=sticky>
<div><img class="resize" src='https://ilias.dhfpg.de/Customizing/global/skin/dhfpgde/images/HeaderIcon.svg'></div>
<div class=topnav2>
    
<div class=dropdown>
    <button style="font-family:arial"  class=dropbtn>ILIAS-Überblick</button>
    <i style="color: grey" class="fa fa-caret-down"></i>
<div style="font-size: 14px;font-family:arial"  class="dropdown-content">
        <a href="#">öffentlich</a>
        <p style="font-size:13px;background-color:rgb(185, 29, 29);color:rgb(255, 255, 255)">Weiterbildungsmöglichkeiten</p>
        <a href="#">Annerkennung Trainerlizenzen</a>
        <a href="#">Weiterbildungs bei der BSA-Akademie</a>
        <a href="#">Weiterbildung an der DHfPG</a> 
</div>
</div>
<div class=dropdown>
    <button style="font-family:arial" class=dropbtn>Service</button> 
    <i style="color: grey;" class="fa fa-caret-down"></i>
<div style="font-size: 14px;font-family:arial"  class="dropdown-content">
        <a href="#">FAQ-ILIAS-Nutzung</a>
</div>
</div>
<div class=dropdown>
    <button  style="font-family:arial" class=dropbtn>Zuletzt besucht</button>
    <i style="color: grey" class="fa fa-caret-down"></i>
    <div style="font-size: 14px;font-family:arial"  class="dropdown-content">
        <a href="#">Zuletzt besuche Seite</a>
    </div>
</div>
</div>

.btn{
背景色:rgb(126128129);/*蓝色背景*/
边框:无;/*删除边框*/
颜色:rgb(255、255、255);/*白色文本*/
填充:12px 16px;/*一些填充*/
字体大小:15px;/*设置字体大小*/
光标:指针;}/*鼠标指针悬停*/
.btn:hover{背景色:rgb(172172172);}
.btn{float:right}
img.resize{
浮动:左;
宽度:285px;
高度:75px;
} 
托普纳夫先生{
背景色:rgb(185,29,29);
溢出:自动;
}
.topnav a{
顶部:0px;
位置:固定;
颜色:#F2F2;
文本对齐:居中;
填充:0px;
文字装饰:无;
字号:17px;
}
.topnav2{
边缘顶部:30px;
背景色:rgb(255、255、255);
溢出:自动;}
.topnav2 a.激活{
背景色:#4CAF50;
颜色:白色;}
.TopNav2A:悬停{
背景色:#ddd;
颜色:黑色;
}
.topnav a.active{
背景色:#4CAF50;
颜色:白色;
}
.dropbtn{
背景色:rgb(255、255、255);
边界:无;
颜色:rgb(126128129);
字体大小:14px;
}
.下拉列表{
浮动:左;
溢出:自动;
}
.下拉菜单{
字体大小:14px;
边界:无;
大纲:无;
颜色:rgb(153、153、153);
填充:14px 16px;
背景色:继承;
字体系列:继承;/*对于手机上的垂直对齐很重要*/
边距:0;/*对于手机上的垂直对齐非常重要*/
}
.下拉内容a{
浮动:无;
颜色:rgb(160160160);
填充:12px 16px;
文字装饰:无;
显示:块;
文本对齐:左对齐;
}
.下拉列表内容a:悬停{
背景色:#ddd;
}
.下拉:悬停.下拉内容{
显示:块;
}
.下拉内容{
显示:无;
位置:绝对位置;
背景色:#f9f9f9;
最小宽度:160px;
盒影:0px 8px 16px 0px rgba(0,0,0,0.2);
z指数:1;
}
.粘的{
边缘顶部:50px;
位置:固定;
排名:0;
宽度:100%;
}
.粘性2{
边缘顶部:15px;
位置:固定;
排名:0;
宽度:100%;
}
#搜索{右边距:1px;}
#滚动条{overflow-y:滚动;
高度:100ex;}
伊利亚斯DHfPG
户口
伊利亚斯-伯布里克

Weiterbildungsmöglichkeiten

服务 祖莱茨特·贝苏特
这是一段代码。 如果有更多的代码需要让我知道。 我现在添加了一些代码。 我有一个很长的段落,所以网站
已填充并有一些内容可滚动。

这是因为您的高度已满且无需滚动(当您可以看到所有内容时),当高度受限时会显示滚动,而不会显示所有内容以帮助您查看项目

编辑:您使用的
位置:固定具有
位置的元素:固定相对于视口定位,这意味着即使滚动页面,它也始终保持在同一位置。顶部、右侧、底部和左侧属性用于定位图元。

.btn{
背景色:rgb(126128129);/*蓝色背景*/
边框:无;/*删除边框*/
颜色:rgb(255、255、255);/*白色文本*/
填充:12px 16px;/*一些填充*/
字体大小:15px;/*设置字体大小*/
光标:指针;}/*鼠标指针悬停*/
.btn:hover{背景色:rgb(172172172);}
.btn{float:right}
img.resize{
浮动:左;
宽度:285px;
高度:75px;
} 
托普纳夫先生{
背景色:rgb(185,29,29);
溢出:自动;
}
.topnav a{
顶部:0px;
颜色:#F2F2;
文本对齐:居中;
填充:0px;
文字装饰:无;
字号:17px;
}
.topnav2{
边缘顶部:30px;
背景色:rgb(255、255、255);
溢出:自动;}
.topnav2 a.激活{
背景色:#4CAF50;
颜色:白色;}
.TopNav2A:悬停{
背景色:#ddd;
颜色:黑色;
}
.topnav a.active{
背景色:#4CAF50;
颜色:白色;
}
.dropbtn{
背景色:rgb(255、255、255);
边界:无;
颜色:rgb(126128129);
字体大小:14px;
}
.下拉列表{
浮动:左;
溢出:自动;
}
.下拉菜单{
字体大小:14px;
边界:无;
大纲:无;
颜色:rgb(153、153、153);
填充:14px 16px;
背景色:继承;
字体系列:继承;/*对于手机上的垂直对齐很重要*/
边距:0;/*对于手机上的垂直对齐非常重要*/
}
.下拉内容a{
浮动:无;
颜色:rgb(160160160);
填充:12px 16px;
文字装饰:无;
显示:块;
文本对齐:左对齐;
}
.下拉列表内容a:悬停{
背景色:#ddd;
}
.下拉:悬停.下拉内容{
显示:块;
}
.下拉内容{
显示:无;
位置:绝对位置;
背景色:#f9f9f9;
最小宽度:160px;
盒影:0px 8px 16px 0px rgba(0,0,0,0.2);
z指数:1;
}
.粘的{
边缘顶部:50px;
排名:0;
宽度:100%;
}
.粘性2{
边缘顶部:15px;
排名:0;
宽度:100%;
}
#搜索{右边距:1px;}
#滚动条{overflow-y:滚动;
高度:100ex;}
伊利亚斯DHfPG
户口
伊利亚斯-伯布里克

Weiterbildungsmöglichkeiten

服务 祖莱茨特·贝苏特
这是因为您的身高已满,无需滚动(当您可以看到所有内容时),当身高受限时会显示滚动,而不会显示所有内容以帮助您查看项目

编辑:您使用的
位置:固定具有
位置的元素:固定相对于视口定位,这意味着它始终保持在同一位置
#scrollbar {overflow-y: scroll;
height:200ex;}

.sticky2 {
    margin-top: 15px;
  position: fixed;
  top: 0;
  width: 100%;
}

.sticky {
    margin-top: 50px;
  position: fixed;
  top: 0;
  width: 100%;
}