Report this

What is the reason for this report?

Where to insert the svg html?

Posted on February 15, 2021

Thanks for the cursor tutorial! In reviewing your instructions for the custom pointer, I saw that you emphasized that the svg file needs a width and height designated for the custom cursor to be visible. Where does the html that includes the width and height values for the svg go? Thanks!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @juliemadermeersman,

Usually, the size of the SVG is selected when the SVG is created and as such is not needed to be specified.

Having said that, you can change the size of it though just by selecting the img and changing its width or height, again like you could a PNG or JPG.

Let’s say you have an image like so:

<img src="DigitalOcean.svg" alt="DigitalOcean SVG">

if you want to add height or width to is you can simply transform it to:

<img src="DigitalOcean.svg" alt="DigitalOcean SVG"width="500" height="600"> 

Now, if you want to add them as a class, you can do the following

<a href="/" class="logo">
  DigitalOcean
</a>
.logo {
  display: block;
  text-indent: -9999px;
  width: 100px;
  height: 82px;
  background: url(DigitalOcean.svg);
  background-size: 100px 82px;
}

Hope this helps! Regards, KFSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.