HTML 元素列表<img>本页总览<img>HTML <img> 标签如何插入图像:实时编辑器<img decoding="async" src="/img/smiley-2.gif" alt="Smiley face" width="42" height="42" /><img decoding="async" src="/img/smiley-2.gif" alt="Smiley face" width="42" height="42" />结果Loading...提示更多实例见页面底部标签定义及使用说明<img> 标签定义 HTML 页面中的图像。<img> 标签有两个必需的属性:src 和 alt。警告从技术上讲,图像并不会插入 HTML 页面中,而是链接到 HTML 页面上。<img> 标签的作用是为被引用的图像创建占位符。提示通过在 <a> 标签中嵌套 <img> 标签,给图像添加到另一个文档的链接。HTML 4.01 与 HTML5之间的差异HTML5 中不支持以下属性:align、border、hspace、longdesc、vspace。在 HTML 4.01 中,以下属性:align、border、hspace、vspace(已废弃)。提示已废弃已废弃的元素或者属性意味着它已经过时。废弃的元素在以后将会过时,但是浏览器会继续支持已废弃的元素。已过时已过时的元素和属性浏览器不再支持,W3C也不会再去定义它。HTML 与 XHTML 之间的差异在 HTML 中,<img> 标签没有结束标签。在 XHTML 中,<img> 标签必须被正确地关闭。属性🆕 :HTML5 中的新属性。属性值描述aligntop bottom middle left rightHTML5 不支持。HTML 4.01 已废弃。 规定如何根据周围的文本来排列图像。loadingeager:立即加载 lazy:延迟加载指定浏览器是应立即加载图像还是延迟加载图像。alttext规定图像的替代文本。borderpixelsHTML5 不支持。HTML 4.01 已废弃。 规定图像周围的边框。crossorigin🆕anonymous use-credentials设置图像的跨域属性heightpixels规定图像的高度。hspacepixelsHTML5 不支持。HTML 4.01 已废弃。 规定图像左侧和右侧的空白。ismapismap将图像规定为服务器端图像映射。longdescURLHTML5 不支持。HTML 4.01 已废弃。 指向包含长的图像描述文档的 URL。srcURL规定显示图像的 URL。usemap#mapname将图像定义为客户器端图像映射。vspacepixelsHTML5 不支持。HTML 4.01 已废弃。 规定图像顶部和底部的空白。widthpixels规定图像的宽度。全局属性<img> 标签支持全局属性,查看完整属性表 HTML全局属性。事件属性<img> 标签支持所有 HTML事件属性。尝试一下 - 实例排列图片本例演示如何在文字中排列图像。浮动图像本例演示如何使图片浮动至段落的左边或右边。设置图像链接本例演示如何将图像作为一个链接使用。创建图像映射本例显示如何创建带有可供点击区域的图像地图。其中的每个区域都是一个超级链接。浏览器兼容性ChromeEdgeFirefoxOperaSafariChrome AndroidFirefox for AndroidOpera AndroidSafari on iOSSamsung InternetWebView AndroidimgFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyalignDeprecatedFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyaltFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyAspect ratio computed from width and height attributesFull supportChrome79Toggle historyFull supportEdge79Toggle historyFull supportFirefox71Toggle historyFull supportOpera66Toggle historyFull supportSafari15Toggle historyFull supportChrome Android79Toggle historyFull supportFirefox for Android79Toggle historyFull supportOpera Android57Toggle historyFull supportSafari on iOS15Toggle historyFull supportSamsung Internet12.0Toggle historyFull supportWebView Android79Toggle historyborderDeprecatedFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historycrossoriginFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historydecodingFull supportChromeYesToggle historyFull supportEdge79Toggle historyFull supportFirefox63Toggle historyFull supportOperaYesToggle historyFull supportSafari11.1Toggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for Android63Toggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOS11.3Toggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyfetchpriorityExperimentalFull supportChrome101Toggle historyFull supportEdge101Toggle historyNo supportFirefoxNoToggle historyNo supportOperaNoToggle historyNo supportSafariNoToggle historyFull supportChrome Android101Toggle historyNo supportFirefox for AndroidNoToggle historyFull supportOpera Android70Toggle historyNo supportSafari on iOSNoToggle historyFull supportSamsung Internet19.0Toggle historyFull supportWebView Android101Toggle historyheightFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyhspaceDeprecatedFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyismapFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyloadingFull supportChrome77Toggle historyFull supportEdge79Toggle historyFull supportFirefox75Toggle historyFull supportOpera64Toggle historyFull supportSafari15.4Toggle historyFull supportChrome Android77Toggle historyFull supportFirefox for Android79Toggle historyFull supportOpera Android55Toggle historyFull supportSafari on iOS15.4Toggle historyFull supportSamsung Internet12.0Toggle historyFull supportWebView Android77Toggle historylongdescDeprecatedFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historynameDeprecatedFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyonerrorDeprecatedFull supportChromeYesToggle historyFull supportEdge79Toggle historyFull supportFirefox51Toggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for Android51Toggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyreferrerpolicyFull supportChrome51Toggle historyFull supportEdge79Toggle historyFull supportFirefox50Toggle historyFull supportOpera38Toggle historyFull supportSafari14Toggle historyFull supportChrome Android51Toggle historyFull supportFirefox for Android50Toggle historyFull supportOpera Android41Toggle historyFull supportSafari on iOS14Toggle historyFull supportSamsung Internet7.2Toggle historyFull supportWebView Android51Toggle historysizesFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historysrcFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historysrcsetFull supportChrome34Toggle historyFull supportEdge18Toggle historyFull supportFirefox38Toggle historyFull supportOpera21Toggle historyFull supportSafari8Toggle historyFull supportChrome Android34Toggle historyFull supportFirefox for Android38Toggle historyFull supportOpera Android21Toggle historyFull supportSafari on iOS8Toggle historyFull supportSamsung Internet2.0Toggle historyFull supportWebView Android37Toggle historyusemapFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historyContent is case-sensitiveFull supportChrome58Toggle historyFull supportEdge79Toggle historyFull supportFirefox51Toggle historyFull supportOpera45Toggle historyFull supportSafariYesToggle historyFull supportChrome Android58Toggle historyFull supportFirefox for Android53Toggle historyFull supportOpera Android43Toggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung Internet7.0Toggle historyFull supportWebView Android58Toggle historyvspaceDeprecatedFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle historywidthFull supportChromeYesToggle historyFull supportEdge12Toggle historyFull supportFirefoxYesToggle historyFull supportOperaYesToggle historyFull supportSafariYesToggle historyFull supportChrome AndroidYesToggle historyFull supportFirefox for AndroidYesToggle historyFull supportOpera AndroidYesToggle historyFull supportSafari on iOSYesToggle historyFull supportSamsung InternetYesToggle historyFull supportWebView AndroidYesToggle history相关文章HTML 教程:HTML 图像