gpt4 book ai didi

html - Bootstrap : How to fix two overlapping content

转载 作者:行者123 更新时间:2023-12-02 19:15:32 25 4
gpt4 key购买 nike

我正在尝试使用此codepen( enter link description here )创建一个网站。我遇到的问题是当我缩小窗口尺寸时,配置文件部分和主要内容部分开始重叠。我认为 codepen 在这里使用引导网格系统,所以我不太明白为什么会发生这种情况。

content overlapping image

这是代码。

HTML

<!--navbar-->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="#page-top">Bootstrap</a>
<div>
<ul class="navbar-nav text-uppercase ml-auto">
<li class="nav-item">
<a class="btn btn-primary my-2 my-sm-0" type="submit"><i class="fa fa-sign-out"></i> Log out</a>
</li>
</ul>
</div>
</div>
</nav>
<!--our content goes here-->
<div class="container content">
<div class="row profile">
<div class="col-md-3">
<div class="profile-sidebar position-fixed">
<!-- SIDEBAR USERPIC -->
<div class="profile-userpic">
<img src="https://media.rockstargames.com/chinatownwars/global/downloads/avatars/zhou_256x256.jpg" class="img-responsive" alt="">
</div>
<!-- END SIDEBAR USERPIC -->
<!-- SIDEBAR USER TITLE -->
<div class="profile-usertitle">
<div class="profile-usertitle-name">
Jason Davis
</div>
<div class="profile-usertitle-job">
Developer
</div>
</div>
<!-- END SIDEBAR USER TITLE -->
<!-- SIDEBAR BUTTONS -->
<div class="profile-userbuttons">
<button type="button" class="btn btn-success btn-sm">Follow</button>
<button type="button" class="btn btn-danger btn-sm">Message</button>
</div>
<!-- END SIDEBAR BUTTONS -->
<!-- SIDEBAR MENU -->
<div class="profile-usermenu sidebar-sticky">
<ul class="nav flex-column">
<li class="active nav-item">
<a href="#" class="nav-link active">
<i class="fa fa-home"></i>
Overview </a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://codepen.io/jasondavis/pen/jVRwaG?editors=1000">
<i class="fa fa-user"></i>
Account Settings </a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" target="_blank">
<i class="fa fa-check"></i>
Tasks </a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<i class="fa fa-flag"></i>
Help </a>
</li>
</ul>
</div>
<!-- END MENU -->
</div>
</div>
<div class="col-md-9">
<div class="profile-content">
Some user related content goes here...
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
<h1>test</h1>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-9 ft">
<footer class="footer">
<div class="row">
<div class="col-md-4">
<span class="copyright">Copyright &copy; Your Website 2018</span>
</div>
<div class="col-md-4">
<ul class="list-inline social-buttons">
<li class="list-inline-item">
<a href="https://github.com/ELMORABITYounes">
<i class="fa fa-github"></i>
</a>
</li>
<li class="list-inline-item">
<a href="https://www.facebook.com/younes.elmorabit.92">
<i class="fa fa-facebook"></i>
</a>
</li>
<li class="list-inline-item">
<a href="https://www.linkedin.com/in/younes-elmorabit-2a162310b/">
<i class="fa fa-linkedin"></i>
</a>
</li>
</ul>
</div>
<div class="col-md-4">
<ul class="list-inline quicklinks">
<li class="list-inline-item">
<a href="#">Privacy Policy</a>
</li>
<li class="list-inline-item">
<a href="#">Terms of Use</a>
</li>
</ul>
</div>
</div>
</footer>
</div>
</div>
</div>

CSS

html, body {
height: 100%;
}
body {
display: flex;
flex-direction: column;
background: #F1F3FA;
}
body {
overflow-x:hidden;
}
#mainNav {
background-color: darkslategrey;
color:white;
}
#mainNav .navbar-brand {
color: #fed136;
font-family: 'Kaushan Script', 'Helvetica Neue', Helvetica, Arial, cursive;
}


.content {
flex: 1 0 auto;
}
.footer {
flex-shrink: 0;
}


footer {
text-align: center;
background-color: white;
}
.ft{
padding-left:22px;
padding-right:31px;
}

footer span.copyright {
font-size: 90%;
line-height: 40px;
text-transform: none;
font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
color:blak;
}

footer ul.quicklinks {
font-size: 90%;
line-height: 40px;
margin-bottom: 0;
text-transform: none;
font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

ul.social-buttons {
margin-bottom: 0;
}

ul.social-buttons li a {
font-size: 20px;
line-height: 40px;
display: block;
width: 40px;
height: 40px;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
color: white;
border-radius: 100%;
outline: none;
background-color: #212529;
}

ul.social-buttons li a:active, ul.social-buttons li a:focus, ul.social-buttons li a:hover {
background-color: #fed136;
}
.content{
margin-top:60px;
}


/* Profile container */
.profile {
margin: 20px 0;
}

/* Profile sidebar */
.profile-sidebar {
padding: 20px 0 10px 0;
background: #fff;
}

.profile-userpic img {
float: none;
display:block;
margin:auto;
width: 50%;
height: 50%;
-webkit-border-radius: 50% !important;
-moz-border-radius: 50% !important;
border-radius: 50% !important;
}

.profile-usertitle {
text-align: center;
margin-top: 20px;
}

.profile-usertitle-name {
color: #5a7391;
font-size: 16px;
font-weight: 600;
margin-bottom: 7px;
}

.profile-usertitle-job {
text-transform: uppercase;
color: #5b9bd1;
font-size: 12px;
font-weight: 600;
margin-bottom: 15px;
}

.profile-userbuttons {
text-align: center;
margin-top: 10px;
}

.profile-userbuttons .btn {
text-transform: uppercase;
font-size: 11px;
font-weight: 600;
padding: 6px 15px;
margin-right: 5px;
}

.profile-userbuttons .btn:last-child {
margin-right: 0px;
}

.profile-usermenu {
margin-top: 30px;
}

.profile-usermenu ul li {
border-bottom: 1px solid #f0f4f7;
}

.profile-usermenu ul li:last-child {
border-bottom: none;
}

.profile-usermenu ul li a {
color: #93a3b5;
font-size: 14px;
font-weight: 400;
}

.profile-usermenu ul li a i {
margin-right: 8px;
font-size: 14px;
}

.profile-usermenu ul li a:hover {
background-color: #fafcfd;
color: #5b9bd1;
}

.profile-usermenu ul li.active {
border-bottom: none;
}

.profile-usermenu ul li.active a {
color: #5b9bd1;
background-color: #f6f9fb;
border-left: 2px solid #5b9bd1;
margin-left: -2px;
}

/* Profile Content */
.profile-content {
padding: 20px;
background: #fff;
min-height: 460px;
}

.nav>li {
position: relative;
display: block;
}

任何帮助将不胜感激,因为我尝试了多种方法但没有成功。

提前谢谢您。

最佳答案

我看到您已向具有 profile-sidebar 类的元素添加了一个 position-fixed 类,因此无论发生什么情况,该元素都将保持固定。

您可以删除 position-fixed 类并处理 CSS 中的所有内容,使用媒体查询为较小和较大的屏幕设置其位置。

关于html - Bootstrap : How to fix two overlapping content,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63766814/

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