Reputation: 660
I have this code in _Layout.cshtml
<p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
instead of "your logo here" I want to add the logo image.
Upvotes: 6
Views: 29094
Reputation: 2723
For MVC layout page, you can implement it, in this below mentioned way:
<div class="navbar-header">
<div class="navbar-header pull-left">
<a class="navbar-brand" href="@Url.Action("Index", "Home")">
<img src="~/Images/Logo.jpg" alt="Site Logo" style="height:25px; width: 25px" /></a>
</div>
<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("Application Name", "Index", "Home", null, new { @class = "navbar-brand" })
</div>
You can style it, the way you want.
Upvotes: 6
Reputation: 1452
To change the default to your image:
Default:
<div class="float-left">
<p class="site-title"><a runat="server" href="~/">your logo here</a></p>
</div>
Copy your image (e.g. “your_image.png” into the already-created “Images” directory and add the “img” tag with that filename as listed below. The example below also changes the “href” to point to your URL (www.your_url.com/) which obviously you would change to whatever Website you need:
<div class="float-left">
<p class="site-title"><a runat="server" href="http://www.your_url.com/"><img src="../Images/ your_image.png" alt="" /></a></p>
</div>
Upvotes: 0
Reputation: 10219
For that you have to make some changes like below.
<p class="site-title">
<a href="@Url.Action("Index", "Home")">
<img src="your/img/path.jpg" alt="" />
</a>
</p>
Upvotes: 10