开发者

HOW 2 place text on an <img>-tag?

开发者 https://www.devze.com 2023-04-06 05:49 出处:网络
Im just wondering how to place html-text开发者_如何学Python on a . Shall I use the absolute -position for this matter?

Im just wondering how to place html-text开发者_如何学Python on a . Shall I use the absolute -position for this matter?

Just so you know Im gonna use the img in a fluid-grid layout.

Thanks for yr ideas?


To place text on an image tag on hover use this...

<img src="#" title="YOUR TEXT HERE" alt="" width="" height="" />

The title will display when someone hovers over the image. The alt tag is what is shown when the image for some reason or another cannot be displayed. These are both useful attributes to use as some screen readers will use the title tag.

If you want actual text over the image you could do something like...

<img src="#" title="YOUR TEXT HERE" alt="" width="100" height="100" /><span style="margin: 20px 0 0 -80px;">YOUR TEXT</span>

This will display the text 20 pixels from the top of your image and 20 pixels in considering your image is 100x100px.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号