- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
编辑 new jsfiddle here成功复制了问题
我的 div 下方出现了这个空白区域。
此处显示 2 张照片,其中一张向下滚动:
我想去掉空格。当包含导航栏时,网页应该占据 100% 的视口(viewport),所以当视口(viewport)改变时它应该改变,它确实是,而且大小合适,但是页面下方有一些随机的空白区域,你可以向下滚动到。空白看起来是导航栏的确切大小。我如何摆脱那个空白区域?请尝试在 the jsfiddle 上
代码:
<nav class="navbar navbar-dark navbar-fixed-top">
<div class="container-fluid">
<button class="navbar-toggler hidden-md-up pull-xs-right"
type="button"
data-toggle="collapse"
data-target="#nav-content">
☰
</button>
<a class="navbar-brand" href="#">THE VEGAN REPOSITORY</a>
<div class="collapse navbar-toggleable-sm" id="nav-content">
<ul class="nav navbar-nav pull-xs-right">
<li class="nav-item">
<a class="nav-link" href="#">FIND</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ADD</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">LOGIN</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">SIGN UP FREE</a>
</li>
</ul>
</div>
</div>
</nav>
<div id="landing-page" class="text-uppercase">
<div class="container-fluid" style="height: 100%;">
<div class="row hidden-lg-up" style="height: 20%;">
<div class="col-xs-3 flex-xs-middle">
<img width="100" src="images/monster2.png" />
</div>
<div class="col-xs-3 offset-xs-6 flex-xs-middle">
<img class="pull-xs-right" width="100" src="images/monster4.png" />
</div>
</div>
<div class="row" id="middle-row">
<div class="col-xs-1 col-sm-2 col-md-3 hidden-md-down flex-xs-top
flex-sm-middle">
<img width="80%" src="images/monster2.png" />
</div>
<div class="col-md-12 col-lg-6 flex-xs-middle ">
<div style="text-align: center;">
<h5 class="display-6">the vegan repository</h5>
<h1 class="display-3">
find vegan stuff* near you.
</h1>
<a id="try-now-button" class="with-border clickable" href="#search-filter-page">
<h5 class="text-center medium-text">try now</h5>
</a>
</div>
</div>
<div class="col-xs-1 col-sm-2 col-md-3 hidden-md-down
flex-xs-top flex-sm-middle">
<img class="pull-xs-right" width="80%" src="images/monster4.png" />
</div>
</div>
<div class="row" style="height:5%;">
<h4 class="display-6 flex-xs-bottom">
*Stuff like restaurants, meat alternatives,
dairy alternatives, and much more!
</h4>
</div>
</div>
</div>
CSS:
#landing-page {
background-color: dimgray;
height: calc(100% - 50px);
margin-top: 50px;
overflow-y: auto;
padding: 10px 40px 10px 40px;
min-height: 396px; }
h1 {
font-size: 10vmin;
color: #FFF; }
h5 {
color: rgba(255, 255, 255, 0.7); }
h4 {
font-size: 1rem;
color: rgba(255, 255, 255, 0.7); }
/* MORE THAN 75 (XL) */
#middle-row {
height: 95%; }
/* LESS THAN 75 (LG) */
@media (max-width: 74.9em) {
#middle-row {
height: 95%; } }
/* LESS THAN 62 (MD) */
@media (max-width: 61.9em) {
#middle-row {
height: 75%; } }
/* LESS THAN 48 (SM) */
@media (max-width: 47.9em) {
#middle-row {
height: 75%; } }
/* LESS THAN 34 (XS) */
@media (max-width: 33.9em) {
#middle-row {
height: 75%; } }
.navbar-toggler {
color: rgba(255, 255, 255, 0.7); }
.navbar-dark .navbar-nav .nav-link {
color: rgba(255, 255, 255, 0.7); }
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-nav .nav-link:hover {
color: #FFF; }
nav {
background-color: #fc4747; }
html, body {
height: 100%; }
编辑 new jsfiddle here成功复制了问题
最佳答案
在CSS
如果你想指定 height
使用百分比的属性,您必须指定 height
父容器的。所以,在你的情况下,你的 #landing-page
元素有它的 parent <body>
标签,和 <body>
标签有其父级 <html>
标签。这就是为什么您必须声明:
html, body { height: 100%; }
在你的 CSS 中。
这里还有一个问题:
<div class="row hidden-lg-up" style="height:20%;">
...
</div>
<div class="row" style="height:95%;">
...
</div>
<div class="row" style="height:5%;">
...
</div>
尝试对所有高度求和 =) 更改它,使它们总和为 100%,您将得到您想要的
更新
我已经成功地在本地重现了您的问题,所以这是解决方案。
实际上,你的问题不是底部的白线,底部的罪魁祸首是 margin-top
#landing-page
的属性(property)元素 =).
看,如果你删除 <nav>
元素,您将在顶部看到相同的白线。您似乎为 #landing-page
设置了 100% 的高度然后将其移至底部。浏览器会在 100% 的 visible 空间绘制背景,但是,正如您所注意到的,您有一些垂直滚动,并且该滚动下的所有内容都没有 background-color.
一般来说,margin
关于 background-color
的地方很棘手或 background-image
因为它可能会导致当前(或类似)问题。移动margin-top
值 padding-top
值具有相同的间距,而不是删除 calc()
来自 height
属性(property),像这样:
#landing-page {
background-color: dimgray;
height: 100%; /* just 100% */
overflow-y: auto;
padding: 60px 40px 10px 40px; /* added margin-top to padding-top */
min-height: 396px; }
关于html - div 下方出现空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38761927/
我正在寻找 css 属性以隐藏带或不带 css 类的段落,如果它包含空格 ( ) 或空白,但我想至少保留一个带或不带的段落,如果有更多的话。 隐藏段落,如果它是空白的或包含 white-space(
在 ruby 中对空白有不同的敏感度/设置吗? 我有一个 RoR 项目,其中一个事件记录调用有很多组件: max_stuff = FooSummary.select("max(stuff)
如何在脚注中的数字后留空? 一般来说,对于所有脚注! 例子: 好 : 1 Hello World 坏:1Hello World 最佳答案 正确答案是不要重新定义\thefootnote ,因为这会在脚
我有这段代码,每次第一个 for 循环再次开始时,我希望它将数组重置为空白,因为它正在使用新用户,但我得到的输出包含一个数组中的所有值。 var items = []; for (var i
我试图在CakePHP中生成一个动态xml文档,以输出到浏览器。 这是我的 Controller 代码: Configure::write ('debug', 0); $this->layout =
当我尝试在 nxos 设备上运行某些命令时,输出末尾有一个空格。我必须将输出与现有变量列表进行比较。末尾的空格导致比较错误。如何在字符串列表中使用 .strip() 函数? - name: Curre
我对 Elasticsearch 相当陌生,我一直在尝试对我的数据进行搜索,并且总是让点击部分为空。即使在数据上传和索引之后也会发生这种情况。我的映射如下: { "mappings":{
我想将about:blank页面更改为firefox插件首页页面的url。 如何更改默认的新标签页网址或可以为新标签页提供默认网址? 我正在使用Firefox附加SDK。 最佳答案 您可以结合使用Ta
我正在使用 R 并具有以下数据框示例,其中所有变量都是因子: first second third social birth control high
如何清空显示对话框的页面。下面是我的代码HTML: .ui-dialog, .ui-dialog-content { border:1px solid #cde68c; border-botto
更新“他的问题是要求我只运行一次 str ,他们已经告诉我该函数只需要一个参数)” 我试图返回第一个不重复的字符,例如:“blazqnqbla”->第一个不重复的字符是“z”,因此函数需要返回z。现在
我的登录验证有问题。问题是当我尝试使用管理员登录时,页面停止在 checklogin.php 上并且不会告诉它是否成功。这是我的代码。 索引.html Aplik
我的查询是这样的 SELECT Distinct tm.teamid,tm.Team_Name,CONCAT_WS(' ',tu.FirstName+' '+tu.LastName) as Leade
我正在创建指向页面的超链接 url 由用户输入决定,因此由查询字符串决定 ; 问题是变量状态由两个或多个单词组成。因此,当我尝试单击证明表单中输入的超链接时,仅获取状态变量的第一个单词。浏览器将另一个
该问题在每个浏览器中的表现都不同,例如在 Firefox 中大约一个空格如果您再次滚动到顶部,则会出现具有相同高度的滚动框。在 chrome 中,滚动时框会变得狭窄等等...... 使用的调用是:
我对菜单栏文字之间的 CSS 空白有疑问。我尝试了很多方法,但仍然无法解决。有人可以帮我吗? 菜单问题图片如下: http://imageshack.us/photo/my-images/201/44
我对 有疑问.其中的插入符根据是否为空具有不同的垂直位置: 我的代码: textarea { padding: 0 5px; border: none; outline: n
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Ignore whitespace in HTML 我想在网页上将图片并排放置。这是我的 HTML:
每当我尝试检查元素时,什么都没有出现。我在使用 Chrome。我明白了 Elements | Network | Sources | Timeline | Profiles | Resources |
我在使用 Chrome、Firefox 和 IE 时遇到了一个奇怪的问题。我正在为我的投资组合网站/博客构建一个 WordPress 主题,一切都很好,直到今天,当我在 chrome 中查看该网站时,
我是一名优秀的程序员,十分优秀!