gpt4 book ai didi

html - 分屏设计布局,一半可滚动内容有巨大的留白区域,无法去除留白

转载 作者:行者123 更新时间:2023-11-28 06:18:45 26 4
gpt4 key购买 nike

我正在开发一个网站,其中正文使用 Materialise 网格分成两部分。网站左侧有一个不会改变的固定图像,右侧有用户可以上下滚动的内容。还有一个固定的导航栏和固定的页脚。这是 layout

向下滚动时,您可以在此处看到空白开始的位置 here

我希望右侧没有任何空白,只显示 div 内容。我通过检查工具查看了每个元素,没有看到额外的填充或边距。我想知道固定左侧是否在左侧底部添加像素?

这是我的 index.html `

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
<title> Sequel Seattle Apartments </title>

<!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>

</head>
<body>
<nav class="white" role="navigation">
<div class="nav-wrapper container">
<a id="logo-container" href="#" class="brand-logo">
<img class="mainlogo" src="logo_navy.png" alt="Sequel Apartments Seattle"/>
</a>
<ul class="bigbuttoncta right hide-on-med-and-down">
<li><a class="waves-effect waves-light btn">Apply Now</a></li>
<li><a class="waves-effect waves-light btn">Contact Us</a></li>
</ul>
<ul class="right hide-on-med-and-down">
<li><a href="#section1">Aparmtents</a></li>
<li><a href="#section2">Sequel Lifestyle</a></li>
<li><a href="#section3">Location</a></li>
<li><a href="#section4">Amenities</a></li>
<li><a href="#section5">Gallery</a></li>
</ul>

<ul id="nav-mobile" class="side-nav">
<li><a href="#">Aparmtents</a></li>
<li><a href="#">Sequel Lifestyle</a></li>
<li><a href="#">Location</a></li>
<li><a href="#">Amenities</a></li>
<li><a href="#">Gallery</a></li> </ul>
<a href="#" data-activates="nav-mobile" class="button-collapse"><i class="material-icons">menu</i></a>
</div>
</nav>

<!-- START OF CONTENT -->
<div id="allcontentfields" class="row">
<!-- Left Hand side of the screen, static content -->
<div class="col s5 leftsection">
<div id="index-banner" class="parallax-container">
<img src="background1.jpg" alt="Unsplashed background img 1">
</div>
</div>
<!-- Right hand side of the screen, all dynamic content -->
<div class="col s7 offset-s5 rightsection" >


<!-- SECTION 1 -->
<div class="section scrollspy" id="section1">
<div class="row">
<h1>Text goes here </h1>
</div>
</div>


<!-- SECTION 2 -->
<div class="section scrollspy" id="section2">
<div class="row">
<div class="parallax-container valign-wrapper">
<div class="section no-pad-bot">
<div class="container">
<div class="row center">
<h5 class="header col s12 light">A modern responsive front-end framework based on Material Design</h5>
</div>
</div>
<div class="parallax"><img src="background2.jpg" alt="Unsplashed background img 2"></div>
</div>
</div>
</div>
</div>

<!-- SECTION 3 -->
<div class="section scrollspy" id="section3">
<div class="row">
<div class="parallax-container valign-wrapper">
<div class="section no-pad-bot">
<div class="container">
<div class="row center">
<h5 class="header col s12 light">A modern responsive front-end framework based on Material Design</h5>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- SECTION 4 -->
<div class="section scrollspy" id="section4">
<div class="row">
<div class="parallax-container valign-wrapper">
<div class="section no-pad-bot">
<div class="container">
<div class="row center">
<h5 class="header col s12 light">A modern responsive front-end framework based on Material Design</h5>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- SECTION 5 -->
<div class="section scrollspy" id="section5">
<div class="row">
<div class="parallax-container valign-wrapper">
<div class="section no-pad-bot">
<div class="container">
<div class="row center">
<h5 class="header col s12 light">A modern responsive front-end framework based on Material Design</h5>
</div>
</div>
</div>
</div>
</div>
</div>

</div>
</div>
</div>


<!-- FOOTER SECTION -->
<footer class="page-footer teal">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h5 class="white-text">Company Bio</h5>
<p class="grey-text text-lighten-4">We are a team of college students working on this project like it's our full time job. Any amount would help support and continue development on this project and is greatly appreciated.</p>


</div>
<div class="col l3 s12">
<h5 class="white-text">Settings</h5>
<ul>
<li><a class="white-text" href="#!">Link 1</a></li>
<li><a class="white-text" href="#!">Link 2</a></li>
<li><a class="white-text" href="#!">Link 3</a></li>
<li><a class="white-text" href="#!">Link 4</a></li>
</ul>
</div>
<div class="col l3 s12">
<h5 class="white-text">Connect</h5>
<ul>
<li><a class="white-text" href="#!">Link 1</a></li>
<li><a class="white-text" href="#!">Link 2</a></li>
<li><a class="white-text" href="#!">Link 3</a></li>
<li><a class="white-text" href="#!">Link 4</a></li>
</ul>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
Made by <a class="brown-text text-lighten-3" href="http://herocreativemedia.com">Hero Creative Media, LLC</a>
</div>
</div>
</footer>


<!-- Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="js/materialize.js"></script>
<script src="js/init.js"></script>

</body>
</html>
`

这是 CSS,我使用的是 Materialize,所以他们也有一个 css 文件,但我没有弄乱它。

/* Custom Stylesheet */
/**
* Use this file to override Materialize files so you can update
* the core Materialize files in the future
*
* Made By MaterializeCSS.com
*/
html, body {
margin:0;
padding: 0;
}

nav ul a,
nav .brand-logo {
color: #444;
}

nav {
position: fixed;
width: 100%;

}





.col {
position:relative;
margin-top: 125px;

}

.row .col.s5 {
margin-left:0;
left:0;
right:0;
padding:0;
}

.row .col.offset-s5 {
padding:0;
height: auto;
}

.leftsection {
position: fixed;
z-index: -1;
margin-top: 200px;
padding:0;
overflow:hidden;
padding-left: 0;
padding-right: 0;

}

.rightsection {
position: relative;
z-index: -1;
margin-top: 200px;
padding:0;
overflow: hidden;
height: auto;



}

#section1 {
position:relative;
height: 700px;
width: 100%;
background-color:red;
overflow-y: scroll;
padding:0;
}

#section2 {
position:relative;
height: 700px;
width: 100%;
padding: 0;
overflow-y: scroll;
}

#section3 {
position:relative;
height: 700px;
width: 100%;
padding:0;
background-color:blue;
z-index: -1;
overflow-y: scroll;
}

#section4 {
position:relative;
height: 700px;
width: 100%;
padding:0;
background-color:yellow;
z-index: -1;
overflow-y: scroll;
}

#section5 {
position:relative;
height: 700px;
width: 100%;
padding:0;
background-color:orange;
z-index: -1;
overflow-y: scroll;
padding-bottom: 0;
}


.mainlogo {
width: 100%;
margin-left: -50px;
margin-top: 40px;

}

.bigbuttoncta {
margin-top: 10px;

}

.bigbuttoncta li {
margin: 20px;
}



p {
line-height: 2rem;
}

.button-collapse {
color: #26a69a;
}

.parallax-container {
min-height: 780px;
line-height: 0;
height: auto;
color: rgba(255,255,255,.9);
z-index: -1;
}
.parallax-container .section {
width: 100%;
}

@media only screen and (max-width : 992px) {
.parallax-container .section {
position: absolute;
top: 40%;
}
#index-banner .section {
top: 10%;
}
}

@media only screen and (max-width : 600px) {
#index-banner .section {
top: 0;
}
}

.icon-block {
padding: 0 15px;
}
.icon-block .material-icons {
font-size: inherit;
}

footer.page-footer {
margin-top: 100%;
display:block;
}

最佳答案

我刚刚发现这是我的 footer.page-footer 的边距顶部设置为 100%,因此实际上创建了一个巨大的滚动条,它显示在屏幕的一半上,因为另一半是固定的。我删除了它,我已经准备好了。

self 注意....删除您在尝试解决问题时输入的愚蠢 CSS。

关于html - 分屏设计布局,一半可滚动内容有巨大的留白区域,无法去除留白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35735925/

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