简体   繁体   English

页脚导航栏与内容重叠

[英]Footer Navbar Overlaps Content

So I have a website that looks like this:所以我有一个看起来像这样的网站:

在此处输入图片说明

(I censored it a little, it's super secret) (我删了一点,这是超级秘密)

Now in full screen on PC this looks just fine but watch what happens when I shrink it down to Mobile Size:现在在 PC 上全屏显示这看起来不错,但是当我将其缩小到移动尺寸时会发生什么:

在此处输入图片说明

I can no longer reach the bottom and see the three buttons.我再也无法到达底部并看到三个按钮。 After experimenting it appears that the buttons shrink down to a very small size and then the bottom navbar overlaps.经过试验,按钮似乎缩小到非常小的尺寸,然后底部导航栏重叠。

<div class="categories-container">
    <div class="container">
        <div class="h1" style="color: #ffffff;text-align: center;">Or Click One of these Core Categories!</div>
        <div class="btn-group btn-group-justified" role="group" aria-label="...">
            <div class="btn-group" role="group" style="padding-right: 10px">
                <button type="button" class="btn btn-success btn-bg" id="category-gameplay-btn"></button>
            </div>
            <div class="btn-group" role="group" style="padding-right: 10px">
                <button type="button" class="btn btn-warning btn-bg" id="category-editor-btn"></button>
            </div>
            <div class="btn-group" role="group">
                <button type="button" class="btn btn-danger btn-bg" id="category-engine-btn"></button>
            </div>
        </div>
    </div>
</div>
<div class="footer-container">
    <div class="navbar navbar-default navbar-fixed-bottom">
        <div class="container" style="text-align: center">
            <span>Website made possible with the following tools</span>
            <br>
            <span>
                <a href="http://https://jquery.com/">jQuery</a> | <a href="http://getbootstrap.com/">Bootstrap</a> | <a href="http://glyphicons.com/">glyphicons | <a href="https://pages.github.com/">Github Pages</a></a>
            </span>
        </div>
    </div>
</div>

This should be the code you need.这应该是您需要的代码。 If you require more let me know.如果您需要更多,请告诉我。

EDIT编辑

CSS Below: CSS如下:

body {
    background-color: #0ba7ff;
}

.header-container .jumbotron {
    background-color: #0ba7ff;
    border-color: #ffffff;
    border-style: solid;
    color: #ffffff;
    text-align: center;
}

@media (max-width: 767px) {
    .jumbotron.jumbotronic {
        padding-left: 20px;
        padding-right: 20px;
    }
}

.categories-container .btn.btn-bg {
    height: 300px;
    font-size: 60px;
    white-space: normal;
}

@media (max-width: 767px) {
    .categories-container .btn.btn-bg {
        height: 150px;
        font-size: 30px;
    }
}
@media (max-width: 480px) {
    .categories-container .btn.btn-bg {
        height: 75px;
        font-size: 22px;
    }
}
@media (max-width: 360px) {
    .categories-container .btn.btn-bg {
        height: 35px;
        font-size: 15px;
    }
}

/* Base styles for the entire tooltip */
[data-tooltip]:before,
[data-tooltip]:after,
.tooltip:before,
.tooltip:after {
    position: absolute;
    visibility: hidden;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0;
    -webkit-transition:
    opacity 0.2s ease-in-out,
    visibility 0.2s ease-in-out,
    -webkit-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
    -moz-transition:
    opacity 0.2s ease-in-out,
    visibility 0.2s ease-in-out,
    -moz-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
    transition:
    opacity 0.2s ease-in-out,
    visibility 0.2s ease-in-out,
    transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform:    translate3d(0, 0, 0);
    transform:         translate3d(0, 0, 0);
    pointer-events: none;
}

/* Show the entire tooltip on hover and focus */
[data-tooltip]:hover:before,
[data-tooltip]:hover:after,
.tooltip:hover:before,
.tooltip:hover:after{
    visibility: visible;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
    opacity: 1;
}

/* Base styles for the tooltip's content area */
.tooltip:after,
[data-tooltip]:after {
    z-index: 1000;
    padding: 8px;
    width: 160px;
    background-color: #000;
    background-color: hsla(0, 0%, 20%, 0.9);
    color: #fff;
    content: attr(data-tooltip);
    font-size: 14px;
    line-height: 1.2;
}

/* Base styles for the tooltip's directional arrow */
.tooltip:before,
[data-tooltip]:before {
    z-index: 1001;
    border: 6px solid transparent;
    background: transparent;
    content: "";
}

/* Horizontally align top/bottom tooltips */
[data-tooltip]:after,
.tooltip:after,
.tooltip-top:after {
    margin-left: -80px;
}

[data-tooltip]:hover:before,
[data-tooltip]:hover:after,
[data-tooltip]:focus:before,
[data-tooltip]:focus:after,
.tooltip:hover:before,
.tooltip:hover:after,
.tooltip:focus:before,
.tooltip:focus:after,
.tooltip-top:hover:before,
.tooltip-top:hover:after,
.tooltip-top:focus:before,
.tooltip-top:focus:after {
    -webkit-transform: translateY(-12px);
    -moz-transform:    translateY(-12px);
    transform:         translateY(-12px);
}

/* Bottom */
.tooltip-bottom:before,
.tooltip-bottom:after {
    top: 100%;
    bottom: auto;
    left: 50%;
}

.tooltip-bottom:before {
    margin-top: -12px;
    margin-bottom: 0;
    border-top-color: transparent;
    border-bottom-color: #000;
    border-bottom-color: hsla(0, 0%, 20%, 0.9);
}

.tooltip-bottom:hover:before,
.tooltip-bottom:hover:after,
.tooltip-bottom:focus:before,
.tooltip-bottom:focus:after {
    -webkit-transform: translateY(12px);
    -moz-transform:    translateY(12px);
    transform:         translateY(12px);
}

Loaded after bootstrap.css bootstrap.css 后加载

It appears you're using bootstrap.看来您正在使用引导程序。 I don't know the coding of your css file but if you do happen to set a height for .categories it'd tend to overlap.我不知道你的 css 文件的编码,但如果你碰巧为 .categories 设置了一个高度,它往往会重叠。 Try give it a .row class and .col-sm-13 for the buttons to remain inline.尝试给它一个 .row 类和 .col-sm-13 以使按钮保持内联。 Once it reaches the screen of a mobile device it won't overlap.一旦它到达移动设备的屏幕,它就不会重叠。 Try.尝试。 I hope this helps or gives you an idea :)我希望这对您有所帮助或给您一个想法:)

<div class="categories-container">
<div class="container">
    <div class="h1" style="color: #ffffff;text-align: center;">Or Click One of these Core Categories!</div>
    <div class="row">
    <div class="btn-group btn-group-justified col-sm-12" role="group" aria-label="...">
        <div class="btn-group" role="group" style="padding-right: 10px">
            <button type="button" class="btn btn-success btn-bg" id="category-gameplay-btn"></button>
        </div>
        <div class="btn-group" role="group" style="padding-right: 10px">
            <button type="button" class="btn btn-warning btn-bg" id="category-editor-btn"></button>
        </div>
        <div class="btn-group" role="group">
            <button type="button" class="btn btn-danger btn-bg" id="category-engine-btn"></button>
        </div>
    </div>
    </div> <!-- row-->
</div>

So here is the solution for anyone else looking after a fix for this:所以这里是其他人解决这个问题的解决方案:

There was none from what I experience, make your own:我的经历没有任何经验,请自己制作:

This is necessary to add:这是必要的补充:

body {
  height: 100%;
}

Here is the CSS for the div which holds the three buttons in question (so basically the last container in your HTML document before the footer):这是div的 CSS,它包含三个有问题的按钮(所以基本上是 HTML 文档中页脚之前的最后一个容器):

.categories-container {
  min-height: 100%;
  margin-bottom: -30px; /* Negative half the height of the footer to leave space*/
  position: relative;
}

Then I made this at the bottom of my index.html page:然后我在index.html页面的底部做了这个:

<div id="wrap">
    <div id="main"></div>
    <div id="footer">
        <a href="http://https://jquery.com/">jQuery</a> | <a href="http://getbootstrap.com/">Bootstrap</a> |
        <a href="http://glyphicons.com/">glyphicons | <a href="https://pages.github.com/">Github Pages</a></a>
    </div>
</div>

Here is the footer CSS:这是页脚 CSS:

#wrap #footer {
    position: relative;
    bottom: 0;
    width: 100%;
    height: 60px;
    background: #f8f8f8;
    text-align: center;
}

#wrap #footer a {
    padding-top: 30px;
}

#wrap #main {
    height: 60px;
    clear: both;
}

I hope this was useful for some!我希望这对某些人有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM