HTML5 - 我可以在IMG中使用宽度和高度吗? [英] HTML5 - Can I use Width and Height in IMG?

查看:125
本文介绍了HTML5 - 我可以在IMG中使用宽度和高度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此代码是合法的:

 < img src =...(here image).. ..width =50pxheight =50px/> 

或者我需要使用:

 < img src =...(此处图片)...style =width:50px; height:50px; /> 


解决方案

建议首次使用作为浏览器渲染的提示,第二个有效。



在第一个表格中,你不能添加'px'。



http://www.w3.org/TR/html5/embedded- content-0.html#dimension-attributes

It is Legal to use this code:

<img src="...(here image)...." width="50px" height="50px" />

Or I need to use:

<img src="...(here image)..." style="width: 50px; height: 50px;" />

解决方案

First use is recommended as hints for the browser's rendering, second one works.

In the first form you must not add 'px'.

http://www.w3.org/TR/html5/embedded-content-0.html#dimension-attributes

这篇关于HTML5 - 我可以在IMG中使用宽度和高度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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