How to insert a gif into HTML
Learn how to embed a GIF in HTML with a step-by-step guide and example.
Inserting a GIF into HTML
Including a GIF in HTML is relatively easy. All you have to do is find a GIF file, upload it to your website, and then include an <img>
tag in your HTML code. Here is an example of how to do this:
<img src="https://example.com/my-gif.gif" width="400" height="300" alt="My GIF">
This code will insert a GIF titled my-gif.gif
located at the URL https://example.com/my-gif.gif
into the webpage. The width
and height
attributes can be used to specify the size of the GIF, while the alt
attribute provides alternative text for users who cannot view the GIF.
It is important to note that GIFs can be quite large and slow down page loading times. To avoid this, you should always compress your GIFs before uploading them. There are a number of tools available online which can help with this, such as EZGIF.
h