我无法在图像上写任何文字。 我昨天一整天都在努力。 这似乎在其他HTML工具(如普通HTML)中有效,因为这里的代码取自w3schools站点,但在Visual Studio ASP.NET MVC中则不起作用。
它将文本显示在图像的底部,而不是图像上。
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="container1">
<img src="~/Content/images/headerBackground.jpg" alt="Snow" style="width:100%;">
<div class="bottom-left1">Bottom Left</div>
<div class="top-left1">Top Left</div>
</div>
</body>
</html>
CSS代码
.container1 {
position: relative;
text-align: center;
color: black;
}
.bottom-left1 {
position: absolute;
left: 16px;
}
尝试添加:
bottom: 10px;
内部。Bottom-left1