Asp.net mvc 3 mvc3如何在图像的下部输入数字
我一直被难住了,我正在试图找到一种方法,将用户ID号放在图像的左下角,有什么方法可以做到这一点吗?为了说明这一点,我已经到目前为止Asp.net mvc 3 mvc3如何在图像的下部输入数字,asp.net-mvc-3,image,Asp.net Mvc 3,Image,我一直被难住了,我正在试图找到一种方法,将用户ID号放在图像的左下角,有什么方法可以做到这一点吗?为了说明这一点,我已经到目前为止 foreach (var item in Model.profile) { // user picture <img src="@Url.Content("~/uploads/profilepic" + item.photo)" alt="" /> // user id number @Html.ActionLink(@item.us
foreach (var item in Model.profile)
{
// user picture
<img src="@Url.Content("~/uploads/profilepic" + item.photo)" alt="" />
// user id number
@Html.ActionLink(@item.userID, "user", "profile",new { id = item.ProfileID })
}
foreach(Model.profile中的变量项)
{
//用户图片
//用户id号
@ActionLink(@item.userID,“user”,“profile”,new{id=item.ProfileID})
}
在上面的代码中,用户ID号出现在图像旁边,但我试图将其放入图像的左下角或右下角。。我已经寻找了几个小时的解决方案,有人能给我一些建议吗?
谢谢这可以通过css解决。首先将actionlink包装在一个div中
foreach (var item in Model.profile)
{
// user picture
<img src="@Url.Content("~/uploads/profilepic" + item.photo)" alt="" />
// user id number
<div class="imageLabel">
@Html.ActionLink(@item.userID, "user", "profile",new { id = item.ProfileID })
</div>
}
这会将你的actionlink移动到图像上初始位置上方20像素处
.imageLabel {
position: relative;
top: -20px;
}