我正在尝试学习Bootstrap,以便在网站的侧边栏中嵌入Twitch聊天和实时视频,但无法按需显示。聊天不会占用所有可用高度(视频应为固定大小)。
我在做什么错? 预先感谢您的帮助,
我的html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Creating Real-Time Charts with Flask</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.css" rel="stylesheet">
<link href="dashboard.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-sm-3 col-md-3 mr-0" href="#">Website title</a>
<input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
</nav>
<div class="container-fluid h-100">
<div class="row h-100">
<div class="col-md-3 d-none d-md-block bg-light sidebar h-100">
<div class="sidebar-sticky">
<div class="row nav flex-column">
<iframe
frameborder="0"
src="https://player.twitch.tv/?channel=esl_csgo&muted=true"
scrolling="no"
allowfullscreen="true">
</iframe>
</div>
<div class="row nav flex-column flex-grow-1 overflow-auto">
<iframe
frameborder="0"
scrolling="yes"
id="chat_embed"
src="https://www.twitch.tv/embed/esl_csgo/chat">
</iframe>
</div>
</div>
</div>
<main role="main" class="col-md-9 ml-sm-auto px-4">
</main>
</div>
</div>
我的CSS:
body {
font-size: .875rem;
}
/*
* Sidebar
*/
.sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
z-index: 100; /* Behind the navbar */
padding: 48px 0 0; /* Height of navbar */
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}
.sidebar-sticky {
position: relative;
top: 0;
height: calc(100vh - 48px);
/* padding-top: .5rem; */
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
}
@supports ((position: -webkit-sticky) or (position: sticky)) {
.sidebar-sticky {
position: -webkit-sticky;
position: sticky;
}
}
/*
* Content
*/
[role="main"] {
padding-top: 133px; /* Space for fixed navbar */
}
@media (min-width: 768px) {
[role="main"] {
padding-top: 48px; /* Space for fixed navbar */
}
}
/*
* Top Navbar
*/
.navbar-brand {
padding-top: .75rem;
padding-bottom: .75rem;
font-size: 1rem;
background-color: rgba(0, 0, 0, .25);
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.navbar .form-control {
padding: .75rem 1rem;
border-width: 0;
border-radius: 0;
}
.form-control-dark {
color: #fff;
background-color: rgba(255, 255, 255, .1);
border-color: rgba(255, 255, 255, .1);
}
.form-control-dark:focus {
border-color: transparent;
box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
}