我有以下圖像標記,我正試圖添加到我的網站。標題中的網站徽標ASP.NET核心MVC
<a href="@Url.Action("Index", "core")" class="navbar-brand">
<img src="~/images/core.png" title="core" alt="additional title" />
</a>
我一直試圖在這兩個頭以及我_Layout.cshtml頁面的身體標籤添加此標記,它結束了僅低於header.Where我應該添加標籤,以便它出現在網站的左上角?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - core</title>
<environment names="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
</environment>
@Html.ApplicationInsightsJavaScript(TelemetryConfiguration)
</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="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-area="" asp-controller="core" asp-action="Index" class="navbar-brand">core</a>
</div>
<div class="navbar-collapse collapse">
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© 2017 - core Inc. - core</p>
</footer>
</div>
<environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
<script src="~/js/site.min.js" asp-append-version="true"></script>
</environment>
@RenderSection("scripts", required: false)
</body>
</html>
在身體,但這將把徽標放在頭下。
<body>
<a href="@Url.Action("Index", "core")" class="navbar-brand">
<img src="~/images/core.png" title="core" alt="additional title" />
</a>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
.
.
.
將它添加到頭部並使用CSS將其放置在頁面的左上角。您可以使用邊距或CSS絕對和相對位置放置圖標。漂浮也可能有所幫助。如果你可以發佈更多的代碼會有所幫助。 – user2330678
你可以分享完整的HTML嗎?或者至少是標題部分? –
您不會添加到
部分,這是爲了只有瀏覽器關心的元信息。您需要查看標記,無論圖像中的黑條是什麼。如果您不確定,請使用開發人員工具突出顯示該元素。 – JakeParis