css - Bootstrap ,导航菜单下的白线,事件链接

标签 css twitter-bootstrap asp.net-mvc-4 visual-studio-2012

我有这个:_Layout.cshtml

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - LolaBikeMen</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>



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



                @Html.ActionLink("LolaBikeMen", "Index", "Home", null, new { @class = "navbar-brand" })
            </div>
            <div class="navbar-collapse collapse">
                <br />
                <div class="float-right">
                    @*<section id="login">
                        @Html.Partial("_LoginPartial")
                    </section>*@

                    <ul class="nav navbar-nav">
                        @*<li>@Html.ActionLink("Home", "Index", "Home")</li>*@
                        <li @if (@ViewContext.RouteData.GetRequiredString("controller") == "Account") { @Html.AttributeEncode("class=active")  ; }>
                            @Html.ActionLink("WHO", "Index", "Account")
                        </li>
                        <li class="{active:isActive}">@Html.ActionLink("WHAT", "Index", "Student")</li>
                        <li class="nav">@Html.ActionLink("AGENDA", "Index", "Course")</li>
                        <li class="nav">@Html.ActionLink("PHILOSPY", "Index", "Instructor")</li>
                        <li class="nav">@Html.ActionLink("BUCKET-LIST", "Index", "Department")</li>
                        <li class="nav">@Html.ActionLink("LolaRiders", "Index", "LolaBiker")</li>
                        <li class="nav">@Html.ActionLink("bycicle", "Index", "Bycicle")</li>

                        <li class="nav"> @Html.Partial("_LoginPartial")</li>

                    </ul>
                </div>
            </div>


        </div>
    </div>
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year - LolaBikeMen</p>
        </footer>
    </div>

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>

这是我的 site.css:

/* Move down content because we have a fixed navbar that is 50px tall */
.container{
    /*background-color:MenuText;*/
}
.container2{

    width:100%;
    height:100%;
}

label
{
    color:white;

}

.add-on .input-group-btn > .btn {
  border-left-width:0;left:-2px;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
/* stop the glowing blue shadow */
.add-on .form-control:focus {
 box-shadow:none;
 -webkit-box-shadow:none; 
 border-color:#cccccc; 
}

body {

    margin-top:90px;


    /*padding-top: 90px;
    padding-bottom: 20px;*/

}

/*html {
            background: url(~/Images/Large.JPG) no-repeat center center fixed;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
        }*/

.wrapper {
  background-image: url(../Images/Large.JPG);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  width: 100%;
  height: 100%;

}
.wide {
  width:100%;
  height:1000px;
  background-image:url('../Images/Large.JPG');
  background-size:cover;
}

.wide img {
  width:100%;
}

navbar{
    color:white;
}

.table-striped>tr>td:nth-child(odd)>td, 
.table-striped>tr>td:nth-child(odd)>td {
    background-color:white;
}

.table.table-condensed tr th {
   border-top: 1px solid white; 
}

.table.table-condensed tr th {
   border-bottom: 1px solid white; 
}

.a:hover, a:focus {
        color:floralwhite;
        text-decoration: underline;
    }

a {
    color:floralwhite;
    text-decoration: none;
}

.table.table-condensed tr td {
   border-bottom: 1px solid white; /* Change the color you want to set */
}

.wrapper {
    width: 100%;
    background-color: lightcyan;
}

img {
    background-image: url('../Images/Large.JPG');
    background-repeat: no-repeat;
    background-position:top;
    background-size:cover;
    width: 100%;
    height: 100%;
}

/**/
#map {
        height: 100%;
        width: 100%;
}

#map img {
        max-width: 100%;
}

html, body {
        height: 100%;
        width: 100%;
}

.hallo{
     background-image: url('../Images/Large.JPG');


}

.fullscreen,
.content-a {
    width:100%;
    min-height:100%;
}


.background {
    background-image: url('../Images/Large.JPG');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: 100%;

}

.fill {
    top: -10px;
    left: 0;
    right: 0;
    bottom: 0;
    position:relative;
    /*overflow-x;*/
    width:100%;
    height:100%;
}

html,body{height:100%;}
.carousel,.item,.active{height:100%;}
.carousel-inner{height:100%;}
.fill{width:100%;height:100%;background-position:center;background-size:cover;}

.navbar {
        margin-bottom: 0;
}

/* Demo */
#map { background:black; }




/**/

/* Wrapping element 
/* Set some basic padding to keep content from hitting the edges */
.body-content {
    padding-left: 15px;
    padding-right: 15px;


}

/* Override the default bootstrap behavior where horizontal description lists 
   will truncate terms that are too long to fit in the left column 
*/
.dl-horizontal dt {
    white-space: normal;
}

/* Set widths on the form inputs since otherwise they're 100% wide */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="select"] {
    max-width: 280px;
}

/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
    .jumbotron {
        margin-top: 20px;
    }
    .body-content {
        padding: 0;

    }
}

如何在菜单栏中的事件链接下方制作一条白线?我尝试使用 Active:IsActive,但如何在事件链接下制作白线。

谢谢

我现在是这样的:

 <ul class="nav navbar-nav">

                        <li class=" nav active">@Html.ActionLink("WHO", "Index", "Account")</li>
                        <li class=" nav active">@Html.ActionLink("WHAT", "Index", "Student")</li>
                        <li class=" nav active">@Html.ActionLink("AGENDA", "Index", "Course")</li>
                        <li class=" nav active">@Html.ActionLink("PHILOSPY", "Index", "Instructor")</li>
                        <li class="nav active">@Html.ActionLink("BUCKET-LIST", "Index", "Department")</li>
                        <li class="nav active">@Html.ActionLink("LolaRiders", "Index", "LolaBiker")</li>
                        <li class="nav active">@Html.ActionLink("bycicle", "Index", "Bycicle")</li>

                        <li class="nav"> @Html.Partial("_LoginPartial")</li>

                    </ul>

还有这个网站:

.active {
            font-style:oblique ;
             border-bottom:1px solid white;

        }

但现在所有元素都有白色条纹,而不仅仅是事件链接。

如果我使用这个:

li.active > a {
    border-bottom:1px solid red;
}

然后所有元素都有红线

如果我这样做:

  <ul class="nav navbar-nav">

                        <li @if (@ViewContext.RouteData.GetRequiredString("controller") == "Account") { @Html.AttributeEncode("class=active")   ; }>
                            @Html.ActionLink("WHO", "Index", "Account")
                        </li>

                        <li @if (@ViewContext.RouteData.GetRequiredString("controller") == "Student") { @Html.AttributeEncode("class=active")    ; }>
                            @Html.ActionLink("What", "Index", "Student")
                        </li>


                        <li class="nav"> @Html.Partial("_LoginPartial")</li>

                    </ul>

仍然突出显示这两个元素

最佳答案

可能的解决方案

li.<active-class> > a {
   border-bottom:1px solid white;
}

替换'<active-class>'使用您正在使用的类名。 f.i.类名 = active 而不是 li.active > a

参见 JSFiddle对于带有红色下划线的示例(红色可以看到结果)

关于css - Bootstrap ,导航菜单下的白线,事件链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26295712/

相关文章:

javascript - bootstrap-datetimepicker 支持 24 :00

twitter-bootstrap - 自动填充 Bootstrap 网格

.net - 如何在 MVC 4 中使用 NHaml?

html - 在 iPad 上垂直查看时 Div 隐藏

PHP 邮件发送不工作

css - Bootstrap 响应式背景图片

javascript - 有什么方法可以通过 css/javascript 进行倾斜/对 Angular 线鼠标悬停吗?

html - 更改移动设备中的顺序

javascript - 如何在 MVC cshtml 页面的 @string.Concat() 中使用 Angular 范围变量

c# - 未在区域中调用 MVC Controller