页脚Navbar重叠内容

时间:2015-11-02 00:37:19

标签: css html5 twitter-bootstrap mobile-browser

所以我有一个看起来像这样的网站:

enter image description here

(我对它进行了一点审查,这是超级秘密)

现在在PC上全屏显示这看起来很好但是看看当我把它缩小到移动尺寸时会发生什么:

enter image description here

我再也无法到达底部并看到三个按钮。经过实验,看起来按钮缩小到非常小的尺寸,然后底部导航栏重叠。

<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>

这应该是您需要的代码。如果您需要更多,请告诉我。

修改

下面的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);
}

在bootstrap.css之后加载

2 个答案:

答案 0 :(得分:1)

看来你正在使用bootstrap。我不知道你的css文件的编码,但如果你碰巧设置了.categories的高度,它往往会重叠。尝试给它一个.row类和.col-sm-13,让按钮保持内联。一旦它到达移动设备的屏幕,它将不会重叠。尝试。我希望这有助于或给你一个想法:)

<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>

答案 1 :(得分:0)

所以这里是其他任何人为此解决问题的解决方案:

根据我的经验,没有任何东西可以自己制作:

这是必要的:

body {
  height: 100%;
}

以下是div的CSS,其中包含三个有问题的按钮(基本上是页脚之前HTML文档中的最后一个容器):

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

然后我在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>

这是页脚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;
}

我希望这对某些人有用!