gpt4 book ai didi

html - 在 Bootstrap 4 中将侧边栏拆分为页眉和页脚

转载 作者:行者123 更新时间:2023-11-28 15:08:41 24 4
gpt4 key购买 nike

目前的网站结构是这样的:

index.html:

<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.css">

<!-- FontAwesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">

<!-- Own styles -->
<link rel="stylesheet" href="css/styles.css">

<title>My website</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-4 sidebar d-flex flex-column align-items-center justify-content-center text-center fixed-top">
<img src="images/avatar.jpg" class="rounded-circle">
<h3 class="text-light">John Doe</h3>
<h5 class="text-light">programmer</h5>
<p class="text-muted mt-5 mb-0">123 456 789</p>
<p class="text-muted">test@test.com</p>
<p class="mt-5 text-white">
<a href="#" class="text-white mr-1">Language 1</a>
|
<a href="#" class="text-white ml-1">Language 2</a>
</p>
<p class="social">
<a href="#" class="text-white mr-1"><i class="fab fa-facebook-f"></i></i></a>
<a href="#" class="text-white ml-1"><i class="fab fa-twitter"></i></i></a>
</p>
<p class="text-muted">&copy; Someone | 2015 - 2019</p>
</div>
<div class="col-12 col-md-8 offset-md-4 d-flex flex-column mt-5 content">
<p>Content</p>
</div>
</div>
</div>

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="js/jquery.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>

样式.css:

@media (max-width: 767.98px) {
.sidebar {
height: auto !important;
padding-top: 10px;
padding-bottom: 10px;
position: static;
}
}

.sidebar {
background-color: #9DB9E8;
height: 100vh;
}

md 和 less 类的设备上,我想将左侧的侧边栏分成两部分。第一部分应位于页面顶部,仅包含以下代码行:

<img src="images/avatar.jpg" class="rounded-circle">
<h3 class="text-light">John Doe</h3>
<h5 class="text-light">programmer</h5>

第二部分应位于页面底部(在类 content 的 div 下)并包含侧边栏中所有剩余的代码行。两个部分都应具有与侧边栏相同的样式。

如何在 Bootstrap 4 中实现这一点?

最佳答案

为此,您应该将它们分成两个 div。

<div id="section1">
(what ever you want in 1st section.)
</div>

<div id="section2">
(whatever you want in 2nd section.)
</div>

关于html - 在 Bootstrap 4 中将侧边栏拆分为页眉和页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53820507/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com