Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

SVG <image>


SVG Image - <image>

The <image> element is used to insert an image in SVG.

SVG software must support JPEG, PNG, and other SVG files.

The <image> element has some basic attributes to position and shape the image:

Attribute Description
width Required. The width of the image
height Required. The height of the image
href Required. The URL of the image
x The x-position for the top-left corner of the image
y The y-position for the top-left corner of the image

Insert an Image

Here we insert a .jpg image inside SVG:

Sorry, your browser does not support inline SVG.

Here is the SVG code:

Example

<svg height="200" width="300" xmlns="http://www.w3.org/2000/svg">
  <image height="200" width="300" href="pulpitrock.jpg" />
</svg>
Try it Yourself »

Code explanation:

  • The height attribute defines the height of the image
  • The width attribute defines the width of the image
  • The href attribute defines the URL of the image

Add Some Graphic

Here we show the image on top of a blue circle, and add a text under the image:

Pulpit Rock, Norway Sorry, your browser does not support inline SVG.

Here is the SVG code:

Example

<svg height="250" width="300" xmlns="http://www.w3.org/2000/svg">
  <circle r="105" cx="150" cy="120" fill="lightblue" />
  <image x="0" y="60" width="300" height="100" href="pulpitrock.jpg" />
  <text x="84" y="180" fill="black">Pulpit Rock, Norway</text>
</svg>
Try it Yourself »

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.