0

我正在尝试在我的引导代码中添加一个图标,但我添加了以下代码:

<li><a href="#"><i class="icon-user"></i>Create Client</a></li>

可以在 Rails 上工作,但不能在 ASP 上工作。该链接没有图标。这对 ASP 是否正确?

我的观点如下:

    <!DOCTYPE html>
    <html>
    <head>
        <title>@ViewData("Title")</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" />
        <style type="text/css">
          body {
            padding-top: 60px;
            padding-bottom: 40px;
          }
        </style>
        <link href="@Url.Content("~/Content/bootstrap-responsive.css")" rel="stylesheet" type="text/css" />
        <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    </head>

    <body>
      <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
          <div class="container">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </a>
            <a class="brand" href="#">Courtenay's Laundry</a>
            <div class="nav-collapse">
                <ul class="nav nav-pills">
                  <li class="active"><a href="/Index">Home</a></li>

                <!-- Dropdown menu Service -->  
                <li class="dropdown" id="menu1">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#menu1">
                      Service
                      <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                      <li><a href="#">Action</a></li>
                      <li><a href="#">Another action</a></li>
                      <li><a href="#">Something else here</a></li>
                      <li class="divider"></li>
                      <li><a href="#">Separated link</a></li>
                    </ul>
                  </li>

                    <!-- Dropdown menu Clients --> 
                    <li class="dropdown" id="menu2">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#menu2">
                          Customers
                          <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                          <li><a href="#">Create Customer</a></li>
                          <li><a href="#">Modify Customer</a></li>
                          <li><a href="#">Delete Customer</a></li>
                          <li class="divider"></li>
                          <li><a href="#">View Loyalty</a></li>
                          <li><a href="#">Manually Change Loyalty</a></li>
                          <li class="divider"></li>
                          <li><a href="#">Notify Client</a></li>
                        </ul>
                      </li>

                    <!-- Dropdown menu Management --> 
                    <li class="dropdown" id="menu3">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#menu3">
                          Management
                          <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                          <li><a href="#">Action</a></li>
                          <li><a href="#">Another action</a></li>
                          <li><a href="#">Something else here</a></li>
                          <li class="divider"></li>
                          <li><a href="#">Separated link</a></li>
                        </ul>
                      </li>

                  <li class="active"><a href="#">Reporting</a></li>
                </ul>
            </div>
          </div>
        </div>
      </div>


      <div class="container-fluid">
      <div class="row-fluid">
        <div class="span2">
            <div class="well sidebar-nav">

            <!--Sidebar content-->
            <ul class="nav nav-list">
            <li class="nav-header">Service Links</li>
            <li><a href="#"><i class="icon-book icon-white"></i>Book Job</a></li>
            <li><a href="#"><i class="icon-book"></i>Book Out Job</a></li>
            <li><a href="#"><i class="icon-random"></i>Station Transfer</a></li>
            <li class="nav-header">Client Quick Links</li>
            <li><a href="#"><i class="icon-user"></i>Create Client</a></li>
            <li><a href="#"><i class="icon-share"></i>Notifications</a></li>
            <li class="nav-header">Reporting</li>
            <li><a href="#"><i class="icon-file"></i>Reporting</a></li>
            <li class="divider"></li>
            <li><a href="#"><i class="icon-cog"></i>Settings</a></li>
            </ul>

            </div>
        </div>
        <div class="span10">
            @RenderBody()      
        </div>
      </div>

    </div>

        <script src="@Url.Content("~/Scripts/jquery.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-transition.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-alert.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/bootstrap-modal.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-dropdown.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-scrollspy.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-tab.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-tooltip.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-popover.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-button.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-collapse.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-carousel.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/bootstrap-typeahead.js")" type="text/javascript"></script>
    </body>
    </html>

我有:

bootstrap-dropdown.js
bootstrap.js
bootstrap.min.js

在我的脚本文件夹中

4

1 回答 1

2

你确定你已经包含了引导样式表吗?您可以使用浏览器控制台检查是否有任何文件无法加载等。您在这里使用的服务器端语言不应该有任何区别。否则 - 检查生成的代码并发布它。我一直使用 ASP.Net MVC 和 Bootstrap,没有问题 - 只要确保你的路径是正确的(我感觉你的 Contents 文件夹中有一个 /bootstrap 文件夹,而你没有正确引用它)!

这是一个简单的 ASP.NET MVC3 '样板'-ish 项目。所以你可以很容易地开始。http://wearereasonablepeople.com/APSMVC3BootstrapBoilerplate.zip

请注意:这里没有花哨的构建脚本,它甚至不包含 LESS 文件,但它可能会帮助您入门。

于 2012-08-16T21:24:12.487 回答