我正在使用bootstrap从头开始创建一个网站,这是我第一次使用bootstrap,所以我可能做错了。
我正在尝试为3个内容列中的每一个实现单独的滚动面板,当滚动显示但灰显但无法正常工作时,它似乎不起作用
我使用stackoverflow html app贴了下面的代码,但是有些元素没有正确显示所以here是到目前为止完全正常工作的网站的链接
body {
padding-top: 159px;
overflow: hidden;
}
html {
overflow: hidden;
}
#navbar_right {}
.container {}
#categorias {
background-color: #171717;
overflow: scroll;
height: 100%;
}
#content {
background-color: #ffffff;
}
.btn {
border-radius: 0;
}
.cat {
margin: 10% 0% 10% 15%;
position: relative;
z-index: 1;
}
#right-bar {
}
/* Menu Top Navbar */
.button {
position: relative;
background-color: inherit;
border: none;
font-size: 16px;
font-family: Roboto;
color: #ffffff;
padding: 20px;
width: 200px;
text-align: center;
-webkit-transition-duration: 0.4s;
/* Safari */
transition-duration: 0.4s;
text-decoration: none;
overflow: hidden;
cursor: pointer;
outline: 0;
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.button:hover {
-webkit-filter: grayscale(0%);
filter: grayscale(0%);
}
.button:after {
content: "";
background: #ffffff;
display: block;
position: absolute;
padding-top: 300%;
padding-left: 350%;
margin-left: -20px!important;
margin-top: -120%;
opacity: 0;
transition: all 0.8s
}
.button:active:after {
padding: 0;
margin: 0;
opacity: 1;
transition: 0s
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>ComISTo Grupo 3</title>
<meta charset="utf-8" />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyhttp://stackoverflow.com/questions/ask#jSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.3.1/css/mdb.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.3.1/js/mdb.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<header class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">ComISTo</a>
</div>
<div id="navbar_right" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<!-- NavBar Buttons -->
<li><button class="button" type="button" onclick="window.location='#'; class=" active ";"><img src="images/empregado.png"/><br/>Chamar Empregado</button></li>
<li><button class="button" type="button" onclick="window.location='#'; class=" active ";"><img src="images/pagar.png"/></br>Pagar</button></li>
<li><button class="button" type="button" onclick="window.location='#'; class=" active ";"><img src="images/ajuda.png"/><br/>Ajuda</button></li>
</ul>
</div>
</header>
</nav>
<div class="container-fluid">
<!-- Content -->
<div class="row">
<!-- Sidebar -->
<div class="col-md-2" id="categorias">
<a href="#" class="cat btn btn-default waves-effect waves-light"><img src="images/broccoli.png" /></br> Vegetariano</a>
<a href="#" class="cat btn btn-default waves-effect waves-light"><img src="images/steak.png" /></br> Carne</a>
<a href="#" class="cat btn btn-default waves-effect waves-light"><img src="images/fish.png" /></br> Peixe</a>
<a href="#" class="cat btn btn-default waves-effect waves-light"><img src="images/glass.png" /></br> Vinhos</a>
<a href="#" class="cat btn btn-default waves-effect waves-light"><img src="images/ice-cream.png" /></br> Sobremesa</a>
</div>
<div class="col-md-6" id="content">
</div>
<div class="col-md-4" id="rightbar"></div>
</div>
</div>
</body>
</html>
&#13;
答案 0 :(得分:1)
我认为问题是#categorias列的高度设置为100%,您应该给出一个特定的高度。尝试类似:
#categorias {
height: 400px
}