< img>的宽度属性与< img style =" width:..." [英] Width attribute for <img> versus <img style="width:..."

查看:213
本文介绍了< img>的宽度属性与< img style =" width:..."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



大家好,


我想知道并理解它们之间的区别,比如说,


< img src =" [path] /ImageFilename.png"宽度= QUOT; 123"高度= QUOT; 456" alt ="">





< img src =" [path] /ImageFilename.png" style =" width:123px;身高:456像素;

alt ="">


从编码的角度来看,存在差异。另外,从一个网页

设计,我相信也存在差异。


为什么HTML表单会被弃用或坏? ...对比CSS形式?

$ b $bGérard

-

删除等等给我发电子邮件

解决方案

GérardTalbot写道:

我想知道并理解它们之间的区别,比如

< img src =" [path] /ImageFilename.png"宽度= QUOT; 123"高度= QUOT; 456" alt ="">



< img src =" [path] /ImageFilename.png" style =" width:123px;身高:456像素;
alt ="">


在第一种形式中,宽度和高度信息仍然存在

当CSS没有使用时。

为什么HTML表单会被弃用还是坏?




不是。你在哪里读到的?


史蒂夫


Steve Pughaécrit:

GérardTalbot写道:

我想知道并理解

< img src ="之间的区别[路径] /ImageFilename.png"宽度= QUOT; 123"高度= QUOT; 456" alt ="">



< img src =" [path] /ImageFilename.png" style =" width:123px;高度:456px;
alt =">



在第一种形式中,宽度和高度信息仍然存在
当CSS不存在时没用过。

为什么HTML表单会被弃用或坏?



不是。你在哪里读到的?

史蒂夫




我不记得我在哪里读过这个或谁这么说过了。


在某些情况下,最好使用CSS表格

(即style =" width:123px; height:456px;")代码HTML

属性代码)。假设你在一个页面上有20个图像,它们都是

具有相同的宽度和高度。然后你就可以了。


img.SameDim {width:[valueX];身高:[valueY];}


但这种情况不太可能经常出现。所以,当你所有的图像都有不同的尺寸时,为什么CSS形式会更好的编码实践或带来某些好处...我可以' '$

看到任何...

$ b $bGérard

-

删除等等电子邮件我


2005年7月22日星期五08:17:54 -0400,GérardTalbot

< ne ******* ****@gtalbot.org>写道:

在某些情况下,使用CSS表格可能会更好
(即style =" width:123px; height:456px;")代码超过HTML
属性代码)。假设你在一个页面上有20个图像,它们都具有相同的宽度和高度。然后就可以了。

img.SameDim {width:[valueX];身高:[valueY];}




对于它的价值,我不同意。


尺寸是图像的固有属性,而不是像边缘那样的b



-

Stan Brown,Oak Road Systems,Tompkins County,New York,USA
http://OakRoadSystems.com/

HTML 4.01规范: http:/ /www.w3.org/TR/html401/

验证者: http://validator.w3.org/

CSS 2.1规范: http://www.w3.org/TR/CSS21/

验证器: http://jigsaw.w3.org/css-validator/

为什么我们不会帮助你:
http://diveintomark.org/archives/200..._wont_help_you



Hello all,

I''d like to know and understand the difference between, say,

<img src="[path]/ImageFilename.png" width="123" height="456" alt="">

and

<img src="[path]/ImageFilename.png" style="width: 123px; height: 456px;"
alt="">

From a coding perspective, there is a difference. Also, from a webpage
design, I believe there is also a difference.

Why would the HTML form be deprecated or bad? ...versus the CSS form?

Gérard
--
remove blah to email me

解决方案

Gérard Talbot wrote:

I''d like to know and understand the difference between, say,

<img src="[path]/ImageFilename.png" width="123" height="456" alt="">

and

<img src="[path]/ImageFilename.png" style="width: 123px; height: 456px;"
alt="">
In the first form the width and height information is still present
when the CSS isn''t used.
Why would the HTML form be deprecated or bad?



It isn''t. Where did you read that?

Steve


Steve Pugh a écrit :

Gérard Talbot wrote:

I''d like to know and understand the difference between, say,

<img src="[path]/ImageFilename.png" width="123" height="456" alt="">

and

<img src="[path]/ImageFilename.png" style="width: 123px; height: 456px;"
alt="">


In the first form the width and height information is still present
when the CSS isn''t used.

Why would the HTML form be deprecated or bad?


It isn''t. Where did you read that?

Steve



I can''t remember where I read that or who said so.

There are situations where it could be better to use the CSS form
(ie. the style="width: 123px; height: 456px;") code over the HTML
attribute code). Let''s say you have 20 images on a page and they all
have the same width and height. Then you can do

img.SameDim {width: [valueX]; height: [valueY];}

but such kind of situation is not likely to appear often. So, when all
your images are of different dimensions, why would the CSS form be a
better coding practice or bring some benefits of some sort... I can''t
see any...

Gérard
--
remove blah to email me


On Fri, 22 Jul 2005 08:17:54 -0400, Gérard Talbot
<ne***********@gtalbot.org> wrote:

There are situations where it could be better to use the CSS form
(ie. the style="width: 123px; height: 456px;") code over the HTML
attribute code). Let''s say you have 20 images on a page and they all
have the same width and height. Then you can do

img.SameDim {width: [valueX]; height: [valueY];}



For what it''s worth, I don''t agree.

The size is an intrinsic property of the image, not a bit of
presentation like a margin.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won''t Help You:
http://diveintomark.org/archives/200..._wont_help_you


这篇关于&lt; img&gt;的宽度属性与&lt; img style =&quot; width:...&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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