Movatterモバイル変換


[0]ホーム

URL:


  1. Tecnologia Web para desenvolvedores
  2. SVG: Gráficos Vetoriais Escaláveis
  3. Reference
  4. Referência de elementos SVG
  5. image

Esta página foi traduzida do inglês pela comunidade.Saiba mais e junte-se à comunidade MDN Web Docs.

View in EnglishAlways switch to English

image

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since julho de 2015.

* Some parts of this feature may have varying levels of support.

O elemento SVG<image> carrega imagens dentro de documentos SVG. Ele pode exibir arquivosraster image ou outros arquivos SVG.

The only image formats SVG software must support areJPEG,PNG, and other SVG files. AnimatedGIF behavior is undefined.

SVG files displayed with<image> aretreated as an image: external resources aren't loaded,:visited stylesaren't applied, and they cannot be interactive. To include dynamic SVG elements, try<use> with an external URL. To include SVG files and run scripts inside them, try<object> inside of<foreignObject>.

Nota:The HTML spec defines<image> as a synonym for<img> while parsing HTML. This specific element and its behavior only apply inside SVG documents orinline SVG.

Usage context

CategoriasElemento gráfico, Elemento gráfico referenciado, Elemento renderizável
Conteúdo permitidoQualquer número dos seguintes elementos, em qualquer ordem:
Elementos de animação
Elementos descritivos
<animate>,<animateMotion>,<animateTransform>,<script>,<set>,<style>

Attributes

Global attributes

Specific attributes

  • x: Positions the image horizontally from the origin.
  • y: Positions the image vertically from the origin.
  • width: The width the image renders at. Unlike HTML's<img>, this attribute is required.
  • height: The height the image renders at. Unlike HTML's<img>, this attribute is required.
  • href andxlink:href: Points at a URL for the image file.
  • preserveAspectRatio: Controls how the image is scaled.

DOM Interface

<image> implements theSVGImageElement interface.

Example

Basic rendering of a PNG image in SVG:

SVG

html
<svg  width="200"  height="200"  xmlns="https://www.w3.org/2000/svg"  xmlns:xlink="https://www.w3.org/1999/xlink">  <image href="mdn_logo_only_color.png" height="200" width="200" /></svg>

Result

Especificações

Specification
Scalable Vector Graphics (SVG) 2
# ImageElement

Compatibilidade com navegadores

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp