如何使ASP.NET MVC导航栏变为水平而不是垂直?

时间:2020-01-08 20:57:04

标签: css asp.net-mvc bootstrap-4 navbar

在我的MVC5页面中,导航栏选项不是并排的,而是垂直折叠的:

Collapsed Uncollapsed 设置是在索引页面还是在bootstrap.css中?这是我的bootstrap.css的一部分,以防有所帮助:

.navbar-nav {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

    .navbar-nav .nav-link {
        padding-right: 0;
        padding-left: 0;
    }

    .navbar-nav .dropdown-menu {
        position: static;
        float: none;
    }

.navbar-text {
    display: inline-block;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.navbar-collapse {
    -ms-flex-preferred-size: 100%;
    flex-basis: 100%;
    -webkit-box-flex: 1;
    -ms-flex-positive: 1;
    flex-grow: 1;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

1 个答案:

答案 0 :(得分:0)

问题不是来自引导程序库。创建新项目时看到的navbar是默认的navbar。如果您想将其更改为左侧的navbar,则引导程序具有不同的navbar类,可以将您暴露给您。例如,您可以将class属性更改为

class="navbar navbar-left"

或访问BootStrap Documentation