.jsp页面中如何把文字写在图片上想要的位置?

在.jsp页面中,我想把Lv写在图片左上角,球员位置写在右上角,人名写在图片左下角。但是现在文字位置不知道为什么有问题?应该怎么办?代码、图片如下。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cards Page</title>
</head>

<body>

        <c:forEach items="${cardItems }" var="pci" varStatus="status">
            <div style="width: 139px; white-space: nowrap; float: left;">
            <a href="${pageContext.request.contextPath }/card/viewCardDetails/${pci.playerCardItemId }"><img style="border:2px solid white; position: relative;" alt="" src="<c:out value="${pageContext.request.contextPath }/${pci.playerCard.player.url }" />"></a>      
            <label  style="position: relative; top:-10px; left:-145px;"><font style="font-weight: bold;"><c:out value="${pci.playerCard.player.name }"></c:out></font></label>
            <label  style="position: relative; top:-170px; left:-135px;"><font style="font-weight: bold;"><c:out value="${pci.playerCard.player.position.abbreviation }"></c:out></font></label>
            <label  style="position: relative; top:-170px; left:-250px;"><font style="font-weight: bold;">Lv<c:out value="${pci.potentiality }"></c:out></font></label>

            </div>
        </c:forEach>


</body>
</html>

图片说明

容器relative定位,label absolut定位

 <div style="width: 139px; white-space: nowrap; float: left;position:relative">
    <a href="${pageContext.request.contextPath }/card/viewCardDetails/${pci.playerCardItemId }"><img style="border:2px solid white; position: relative;" alt="" src="<c:out value=" ${pagecontext.request.contextpath } />${pci.playerCard.player.url }" />"></a>
    <label style="position:absolute; bottom:0px; left:0px;"><font style="font-weight: bold;"><c:out value="${pci.playerCard.player.name }"></c:out></font></label>
    <label style="position:absolute; top:0px; right:0px;"><font style="font-weight: bold;"><c:out value="${pci.playerCard.player.position.abbreviation }"></c:out></font></label>
    <label style="position:absolute; top:0px; left:0px;"><font style="font-weight: bold;">Lv<c:out value="${pci.potentiality }"></c:out></font></label>

</div>

使用绝对定位来写吧~

你就把它当成一个html就好

<c:forEach items="${cardItems }" var="pci" varStatus="status">
            <div style="width: 139px; white-space: nowrap; float: left;position:relative;">
            <a href="${pageContext.request.contextPath }/card/viewCardDetails/${pci.playerCardItemId }"><img style="border:2px solid white; position: relative;" alt="" src="<c:out value="${pageContext.request.contextPath }/${pci.playerCard.player.url }" />"></a>      
            <label  style="position: absolute; top:0px; left:0px;"><font style="font-weight: bold;"><c:out value="${pci.playerCard.player.name }"></c:out></font></label>
            <label  style="position: absolute; top:0px; right:0px;"><font style="font-weight: bold;"><c:out value="${pci.playerCard.player.position.abbreviation }"></c:out></font></label>
            <label  style="position: absolute; bottom:0px; left:0px;"><font style="font-weight: bold;">Lv<c:out value="${pci.potentiality }"></c:out></font></label>

            </div>
        </c:forEach>

改成这样