18910140161

HTML-确定图像上文本的位置-堆栈溢出

顺晟科技

2022-10-18 12:07:47

219

当文本发生变化时,

我必须保持文本的位置。

谢谢帮忙.

<代码><;范围>;<;a href=“ JavaScript:MoveToNewWindow(' UserRecords.htmpl ');”>;<;IMG ID=“ mycalls ” SRC=“ btn-mycalls-reg.PNG ” style=" cursor:指针;宽度:208px;高度:124px;“ onmouseover=” HoverMyCalls(this)“ onmouseout=” OrigMyCalls(this)">;<;/a>;<;span CLASS=“ CountCalls ” ID=“ CountCallsID ” style="文本对齐:右;位置:绝对;顶部:5.60em;右:52.2em;>;1<;/span>;<;/span>;
源图像image source

enter image description here

enter image description here


顺晟科技:

如果你给图层一个100%的宽度,那么你可以使用文本中心将数字居中。

请注意,<span> <a href="javascript:moveToNewWindow('userRecords.htmpl');"> <img id="MyCalls" src="btn-mycalls-reg.png" style="cursor:pointer; width:208px;height:124px;" onmouseover="hoverMyCalls(this)" onmouseout="origMyCalls(this)"> </a> <span class="countCalls" id="countCallsId" style=" text-align: right; position: absolute; top: 5.60em; right: 52.2em; ">1</span> </span>与字体大小有关。在这种情况下,您也可以使用px,因为图像的绝对大小为208x124px.

<代码><;范围>;<;a href=";JavaScript:moveToNewWindow(' userRecords.HTML ');";>;<;IMG ID=";我的呼叫";SRC=";btn-mycalls-reg.PNG";onmouseover=";HoverMyCalls(this)";onmouseout=";OrigMyCalls(this)";>;<;/a>;<;span类=";计数调用";ID=";countCallsId";>;123<;/span>;<;/span>;

使用CSS

top: 2.5em;
  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航