Bootstrap-如何正确调整我的下拉菜单的位置?

时间:2018-08-25 16:54:03

标签: html css

我正在尝试使用Bootstrap创建一个响应式网站。当窗口变得很小时,导航菜单应该折叠。问题是,当它折叠并且我展开菜单时,它看起来很糟糕,因为它的位置不正确。

This is the "normal" view when nothing is collapsed

This is when it is collapsed

When I now expand the menu

最后一张图片显示了问题。我希望能够重新定位菜单,使其以一种美观的方式位于徽标下方,并且没有突然穿过我徽标的奇怪白线。 有人可以解释一下如何解决这个问题吗?

这是我的代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>test</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>      
    <link rel="stylesheet" type="text/css" href="css/test.css">

</head>
<body>

    <!--Navigation bar-->
    <nav class="navbar navbar-custom navbar-fixed-top navbar-expand" id="myNavbar">
        <div class="container">
            <div class="navbar-brand">
                <img src="images/testLogo.png">
            </div>
            <button class="navbar-toggler navbar-toggler-right text-uppercase bg-primary text-white rounded" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
        </div>
            <div id="navbarResponsive" class="collapse navbar-collapse">
                <ul class="nav navbar-nav navbar-right" id="ul">    
                <li class="active"><a href="main.html">Home</a></li>
                    <li><a href="services.html">Services</a></li>
                <li><a href="projects.html">Partners</a></li>
                <li><a href="contact.html">Contact</a></li>
            </ul>
            </div>

    </nav>
</body>
</html>

CSS:

/**
 * Navigation bar.
 */

#myNavbar
{
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
    background-color: rgb(100, 100, 100);
}

#navbarResponsive
{
    width: 65%;
}
/*
.navbar-collapse
{
    flex-basis: 100%;
    flex-grow: 1;
}
*/
.nav > li > a
{
    font-size: 18px
}

.navbar-brand
{
    font-size: 28px;
}

img
{
    height: 70px;
    width: 70px;
    float: right;
    margin-top:-20px;
    margin-left: 20px;
}

.navbar > .container, .navbar > .container-fluid
{
    display: flex;
    justify-content: space-between;
}

@media (min-width: 900px)
{
    .navbar-toggler
    {
        display:none;
    }
}

.container
{
    width: 100%;
}

button
{
    background-color: transparent;
}

.bg-primary
{
    background-color: transparent;
}
.navbar-toggler-icon
{
    background-color: transparent;
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

1 个答案:

答案 0 :(得分:0)

尝试

python3.7
import mapnik
>>> mapnik.Map(600,400)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'mapnik' has no attribute 'Map'

移动版

相关问题