<ellipse>
<image>
<line>
<path>
<polygon>
<polyline>
<rect>
<use>
<feBlend>
<feColorMatrix>
<feComponentTransfer>
<feComposite>
<feConvolveMatrix>
<feDiffuseLighting>
<feDisplacementMap>
<feDistantLight>
<feFlood>
<feFuncA>
<feFuncB>
<feFuncG>
<feFuncR>
<feGaussianBlur>
<feImage>
<feMerge>
<feMergeNode>
<feMorphology>
<feOffset>
<fePointLight>
<feSpecularLighting>
<feSpotLight>
<feTile>
<feTurbulence>
<filter>
<font>
<font-face>
<font-face-format>
<font-face-name>
<font-face-src>
<font-face-uri>
<foreignObject>
<image>
SVG element includes images inside SVG documents. It can display
raster image
files or other SVG files.
The only image formats SVG software must support are JPEG , PNG , and other SVG files. Animated GIF behavior is undefined.
SVG files displayed with
<image>
are
treated as an image
: external resources aren't loaded,
:visited
styles
aren'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>
.
注意:
The HTML spec defines
<image>
as a synonym for
<img>
while parsing HTML. This specific element and its behavior only apply inside SVG documents or
inline SVG
.
| 类别 | Graphics element, Graphics referencing element |
|---|---|
| 准许内容 |
Any number of the following elements, in any order:
Animation elements Descriptive elements |
class
style
transform
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
and
xlink:href
: Points at a URL for the image file.
preserveAspectRatio
: Controls how the image is scaled.
crossorigin
: Defines the value of the credentials flag for CORS requests.
<image>
实现
SVGImageElement
接口。
Basic rendering of a PNG image in SVG:
<svg width="200" height="200"
xmlns
=
"
http://www.w3.org/2000/svg
"
>
<
image
href
=
"
mdn_logo_only_color.png
"
height
=
"
200
"
width
=
"
200
"
/>
</
svg
>
| 规范 |
|---|
|
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
(SVG)
# ImageElement |
BCD tables only load in the browser
最后修改: , 由 MDN 贡献者