如何给背景图片加上alt和标题? [英] How to give alt and title for background image?

查看:67
本文介绍了如何给背景图片加上alt和标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为背景图片赋予alt和标题?有可能吗?

How to give alt and title for background image? Is it possible?

<div id="cont"></div>

  #cont
  {
     background:#FFF url(../images/post.png) no-repeat;
  }

推荐答案

您不能为CSS背景指定alt和标题,但可以为div命名.

You cannot give an alt and title for a css background, but you can give a title to the div.

<div id="cont" title="Title!"></div>

鼠标悬停在div元素上时,标题将弹出.

The title will popup upon mouse-idle over the div element.

这篇关于如何给背景图片加上alt和标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆