locked
apply css to loginpartial.cshtml in .net core RRS feed

  • Question

  • User439135325 posted

    <style>
    .navbar-nav > li > a, .navbar-brand {
    padding-top: 5px !important;
    padding-bottom: 0 !important;
    height: 30px;
    }
    .navbar {
    min-height: 30px !important;
    }
    </style> have it in the _layout.cshtml. How to apply the same to _loginpartial.cshtml below

    @if (SignInManager.IsSignedIn(User))
    {
    <form asp-area="" asp-controller="Account" asp-action="LogOut" method="post" id="logoutForm" class="navbar-right">
    <a style="color:white" asp-area="" asp-controller="Account" asp-action="ChangePassword" title="Manage">Hello @UserManager.GetUserName(User)!</a>
    <button type="submit" class="btn btn-link navbar-btn navbar-link">Log out</button>
    </form>
    }
    else
    {
    <a class="navbar-brand" asp-area="" asp-controller="Account" asp-action="Register">Register</a>
    <a class="navbar-brand" asp-area="" asp-controller="Account" asp-action="Login">Log in</a>

    }

    Saturday, July 21, 2018 4:11 PM

All replies

  • User1724605321 posted

    Hi malathip ,

    Not sure what is your problem , if you have the style in _layout.cshtml , it will affect the _loginpartial.cshtml , since it is a partial view in _layout :

     <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        <li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
                        <li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
                        <li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
                    </ul>
                    <partial name="_LoginPartial" />
     </div>

    If i misunderstand your scenario , please feel free to let me know .

    Best Regards,

    Nan Yu

    Monday, July 23, 2018 3:14 AM