FontAwesome图标与NavBar在同一行

时间:2019-01-03 16:18:33

标签: html css

我有一个导航栏,在用户登录之前,它会正确显示。

登录之前: enter image description here

登录后:

enter image description here

我很难弄清楚为什么注销的Fontawesome图标与登录时的头像图标大小相同(我尝试使其略小一些)的原因还是绕到了下一行。问题不在于父div的宽度,因为我尝试添加另一个<li><a>Test Item</a></li>并且它没有包装到下一行。

HTML:

<ul class="nav navbar-nav navbar-right">
                    <li><a class="active" href="../../">Home</a></li>
                    <li><a href="../../Home/Build">Build A Box</a></li>
                    <li><a href="../../Home/Faq">FAQ</a></li>
                    <li><a href="../../Home/Contact">Contact Us</a></li>
                    @if (User.Identity.IsAuthenticated)
                    {
                        <li><a href="../../Home/Account">My Account</a></li>
                        using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
                        {
                            @Html.AntiForgeryToken()


                                <li><a href="javascript:document.getElementById('logoutForm').submit()" class="nav-link fa fa-sign-out"></a></li>

                        }
                    }
                    else
                    {
                        <li class="nav-item dropdown">
                            <a href="#" id="LoginDropdownLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="button" class="nav-link dropdown-toggle fa fa-user-circle"></a>
                            <div class="dropdown-menu" aria-labelledby="LoginDropdownLink">
                                @using (Html.BeginForm("Login", "Account", new { ReturnUrl = "../../Home/Account" }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
                                {
                                    @Html.AntiForgeryToken()


                                    @Html.ValidationSummary(true, "", new { @class = "text-danger" })



                                            @Html.TextBoxFor(m => m.Email, new { @class = "input-text", @placeholder="Email Address"})
                                            @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" })



                                            @Html.PasswordFor(m => m.Password, new { @class = "input-text", @placeholder="Password" })
                                            @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })



                                                @Html.CheckBoxFor(m => m.RememberMe)
                                                @Html.LabelFor(m => m.RememberMe)


                                            <input type="submit" value="Log in" class="btn btn-default" />


                                }
                            </div>
                        </li>
                    }
                </ul>

1 个答案:

答案 0 :(得分:1)

很难说没有CSS,但要尝试删除 #include <stdio.h> #include <string.h> int main (void) { int i, j, k, l=0, m=0, s=0, N=100; printf("input a sentence with no more than 100 characters \n"); char sentence[N]; scanf("%[^\n]s", sentence); int slength=strlen(sentence); printf("Sentence before sorting - %s \n", sentence); /*capital string keeps track of position of capital letters*/ int capital[slength]; for (i = 0; i < slength-1; i++) { for (j = i+1; j < slength; j++) { /*make uppercase letters lowercase */ if (sentence[j-1] <=90 && sentence[j-1]>64) { capital[l]=i; sentence[i]=sentence[i]+32; } /* skip to next word if a space is detected */ if(sentence[j]==' ') { i=j+1; j=j+2; } /*alphabetize loop*/ if (sentence[i] > sentence[j]) { k = sentence[i]; sentence[i] = sentence[j]; sentence[j] = k; } } } printf("Sentence after sorting - %s \n", sentence); return 0; } 退出链接的class属性(代码中的l.14)。

因此该行将是:

nav-link

因为其他链接没有此类,所以我怀疑这是造成您麻烦的原因。