制作固定大小

时间:2016-01-14 08:59:16

标签: html css twitter-bootstrap

我正在尝试将下拉子菜单添加到bootstrap菜单栏中,当我将鼠标悬停在"人员方面时,子菜单会立即出现。但是当子菜单出现时,它会扩展菜单栏的大小。有没有办法修复菜单栏的大小

这是代码

<div class="navbar navbar-inverse navbar-fixed-top" >
        <div class="container" >
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <div >
                    @*  @Html.ActionLink("Application name", "Index", "Home", null, new { @class = "navbar-brand" })*@<img src="~/Images/InfosysLogo.png" style="height:70px;width:200px" />
                </div>
            </div>
            <div class="navbar-collapse collapse">
                <ul id="nav" class="nav navbar-nav">
                    <li>@Html.ActionLink("DashBoard", "ExecutiveDashboard", "Charts")</li>
                    <li>@Html.ActionLink("Engagement Metrics", "EngagementMatrix", "Charts")</li>
                    <li>@Html.ActionLink("Quality Metrics", "Contact", "Home")</li>
                    <li>
                        @Html.ActionLink("People Aspects", "Contact", "Home")

                    <ul id="subnav">
                        <li>@Html.ActionLink("Certifications", "Index", "Certification", new { @class = "my-class" })</li>
                        <li>@Html.ActionLink("Trainings", "Index", "Training", new { @class = "my-class" })</li>
                    </ul>
                </li>
                <li>@Html.ActionLink("Financials", "BudgetVSActualChart", "Financial")</li>
                <li>@Html.ActionLink("Admin", "AdminView", "PMODashboard")</li>
            </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li class="navbar-text">Hello, @User.Identity.Name!</li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container body-content"> 

任何帮助都会很明显。 谢谢

2 个答案:

答案 0 :(得分:0)

示例尝试使用此css代码并检查

<强> HTML

<div class="navbar navbar-inverse navbar-fixed-top" >

</div>

<强> CSS

.navbar{
 width:980px;
}

答案 1 :(得分:0)

<强> HTML

<div class="navbar navbar-inverse navbar-fixed-top" >

</div>

<强> CSS

.navbar{
 min-height:90px !important;
}

解决了我的问题,它将最小高度设置为90px所以当我在菜单项上盘旋时子菜单项目没有扩展我的菜单栏