html方框显示在圆中间

html方框显示在圆中间,第1张

网络原因。html是超文本标记语言,html方框显示在圆中间是网络原因,html即超文本标记语言,HTML是由Web的发明者TimBerners-Lee和同事 DanielW. Connolly于1990年创立的一种标记语言,它是标准通用化标记语言SGML的应用。

方案一:文字浮动定位到图片上

<div class="img_wd">

   <div class="c_img"><img src="test.jpg" width="100px" height="100px"/></div>

   <div class="c_words">测试文字</div>

</div>

<style>

.c_img{position:relative}

.c_words{position:absolutetop:35pxheight:30pxline-height:30px}

</style>

如要文字居中显示:top值=(图片高度-文本div高度)/2

如需要求水平居中:left=(图片宽度-文本div宽度)/2

方案二:用图片做文字图层背景

<div class="img_wd">测试文字</div>

<style>

.img_wd{

background:url(test.jpg) top center no-repeat

width:100pxheight:100pxline-heiht:100px

text-align:center}

</style>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/6096597.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-03-14
下一篇2023-03-14

发表评论

登录后才能评论

评论列表(0条)

    保存