以下内容为Stackoverflow上整理以作纪录
PRO 用IMG标签
- Use
IMGplus alt attribute if the image is part of the content such as a logo or diagram or person (real person, not stock photo people). —sanchothefat如果图片是内容的重要部分例如logo,人员信息的头像等,用img标签,别忘了alt属性 - Use
IMGif you intend to have people print your page and you want the image to be included by default. —JayTee
如果你想别人打印你的页面时连图片一起打印,那末用img - Use
IMG(withalttext) when the image has an important semantic meaning, such as a warning icon. This ensures that the meaning of the image can be communicated in all user-agents, including screen readers.
如果图片有很重要的语义,例如表示警告的图标,为了保证被别的客户端设备例如屏幕阅读器所识别,那末使用IMG标签,别忘了alt属性 - Use
IMGif you rely on browser scaling to render an image in proportion to text size.
当用户改变文本尺寸比例时(通过浏览器如ctr+),使用IMG标签可以使图片正常按比例缩放 - Use
IMGfor multiple overlay images in IE6.
IE6下面多张图片交叠效果需要用IMG标签(具体用处不明) - Use
IMGwith az-indexin order to stretch a background image to fill its entire window.
使用img标签以及z-index可以撑开整个窗口的背景图。(具体不知道啥意思) - Using
imginstead ofbackground-imagecan dramatically improve performance of animations over a background.
针对图片进行动画交互时使用img标签可显著提升性能
CON 用背景图
- Use CSS background images if the image is not part of the content. —sanchothefat
图片不是内容的主体组成部分时,考虑用背景图 - Use CSS background images when doing image-replacement of text eg. paragraphs/headers. —sanchothefat
需要使用图片替代文字的时候考虑用背景图,比如标题内容、段落内容,有时候需要用更有质感的图片替代部分内容 - Use
background-imageif you intend to have people print your page and you do not want the image to be included by default. —JayTee
别人打印你的网页,你不想让他打印到图片时考虑用背景图 - Use
background-imageif you need to improve download times, as with CSS sprites.
合图即css sprite可减少服务器请求次数,用背景图 - Use
background-imageif you need for only a portion of the image to be visible, as with CSS sprites.
用背景图可以利用css的background-position控制图片的可见范围
以下内容为Stackoverflow上整理以作纪录的更多相关文章
- GitHub上整理
GitHub上整理 技术站点 Hacker News:非常棒的针对编程的链接聚合网站 Programming reddit:同上 MSDN:微软相关的官方技术集中地,主要是文档类 infoq:企业级应 ...
- [转帖]GitHub上整理的一些工具
GitHub上整理的一些工具 技术站点 Hacker News:非常棒的针对编程的链接聚合网站 Programming reddit:同上 MSDN:微软相关的官方技术集中地,主要是文档类 inf ...
- 为什么 StackOverflow 上的代码片段会摧毁你的项目?
昨天公司里碰到一件令人哑然失笑的事情.帮朋友公司做的一个项目,做SIT测试的时候发现一些bug,仔细查了下原因,原来是因为当初觉得这个项目比较简单,交给了几个新入职的新丁,也算是给他们练练手,结果其中 ...
- 老码农教你在 StackOverflow 上谈笑风生
作为一个高大上的码农,你肯定用到过 StackOverflow,必须的.会有人否定这个断言么?那他恐怕不是真正的码农,或者说还没入门.StackOverflow 对于码农的重要性,基本就和诸葛亮对刘备 ...
- stackoverflow上关于iOS的票数最多(最常见)的15个问题
搞编程做项目的,没碰到bug.遇到问题,基本不可能.stackoverflow就是一个大型的开放的FAQ平台,你是问题制造者,也是答案提供者.本文列出至今stackoverflow上关于iOS的票数最 ...
- Stackoverflow上有哪些声望高or值得关注的国人
Stackoverflow上有哪些声望高/值得关注的国人? 以下回答并不严格按照 Reputation 排名来列,也不收录不确定是Chinese(中国人或华人)的用户,欢迎补充- 1.李杨 @Li L ...
- 记一次在StackOverFlow上问问题的经历
最近一直在做测试方面的事情,被测的一些功能需要连接到FTP服务器上.而我在做本地测试时为了方便,就使用java写了一个简单的ftp服务器,可以在命令行下直接启动运行. 当时在main函数里是这样写的. ...
- 我发现:在StackOverflow上拯救歪果仁十分有意思!
菊长:火星特工们!今天是周五了,大家有什么提议? BeJavaGod:报告菊长!我发现,在StackOverflow上拯救歪果仁十分有意思! 噗哈哈,时不时遇到问题会使用到StackOverflow, ...
- TOGAF架构内容框架之内容元模型(上)
TOGAF架构内容框架之内容元模型(上) 2. 内容元模型(Content Metamodel) 在TOGAF的眼中,企业架构是以一系列架构构建块为基础的,并将目录.矩阵和图形作为其具体展现方式.如果 ...
随机推荐
- MyEclipse部署项目报"Add Deployment". Invalid Subscription Level - Discontinuing this MyEclipse
"Add Deployment". Invalid Subscription Level - Discontinuing this MyEclipse 猜测应该是MyEclipse ...
- 80端口被System进程占用问题
更新: 有可能占用80端口的服务: 如果安装了IIS,关闭IIS: 如果未开启IIS功能,而安装了诸如Web Matrix的开发程序,则有可能被Web Development Agent Servic ...
- LightOJ - 1370
Bi-shoe and Phi-shoe Time Limit: 2000MS Memory Limit: 32768KB 64bit IO Format: %lld & %llu S ...
- POJ-2594
Treasure Exploration Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 7035 Accepted: 2 ...
- git 查看远程分支 $ git branch -a
查看远程分支 加上-a参数可以查看远程分支,远程分支会用红色表示出来(如果你开了颜色支持的话): 1 2 3 4 5 6 7 8 9 10 $ git branch -a master remote ...
- Django-form組件補充
自定义验证规则 方法一: 1 2 3 4 5 6 7 8 9 10 from django.forms import Form from django.forms import widgets f ...
- python中global变量释疑
疑问 为什么main中不能写global x语句? 在函数中如何修改global变量? 在main中修改了global变量后,在子进程中为什么没有效果? 如何利用进程池的initializer参数(函 ...
- Nmap误报1720端口开放的原因
在使用Nmap扫描服务器开放端口(全连接扫描)时,一直会发现误报1720端口开放,telnet也有时会连接成功.而实际上服务器并未开启此端口.经过查阅资料,确定原因如下: H.323协议在负载中放入了 ...
- python 截取指定长度汉字
这个方法不是很好,不知道有没有更好的方法 def cut_hz(s, length): charstyle = chardet.detect(s) t = s[:length] try: unicod ...
- CodeForces 731E Funny Game
博弈,$dp$. 设$f[i]$表示 如果先手第一次出手取到位置$i$,直到游戏结束,双方均采取最优策略,先手-后手得分的差值. 那么$f[i]=min(sum[i]-sum[j]+maxf[j+1] ...