Two ways:

<img src="..." border="1" />

or

<img style='border:1px solid #000000' src="..." />
Answer from Diodeus - James MacFarlane on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Reference › Properties › border-image
border-image - CSS | MDN - Mozilla
The border-image CSS property draws an image around a given element. It replaces the element's regular border.
🌐
W3Schools
w3schools.com › css › css3_border_images.asp
CSS Border Images
With the CSS border-image property, you can define an image to be used as the border around an element.
🌐
W3Schools
w3schools.com › cssref › css3_pr_border-image.php
CSS border-image property
❮ Previous Complete CSS Reference ... · More "Try it Yourself" examples below. The border-image property allows you to specify an image to be used as the border around an element....
🌐
CSS-Tricks
css-tricks.com › revisiting-css-border-image
Revisiting CSS border-image | CSS-Tricks
March 21, 2025 - First is the border-image-slice value, where zero pixels ensures that the eight corners and edges stay empty. The fill keyword ensures the middle section is filled with the linear gradient. Second, the border-image-source is a CSS linear gradient that blends blue into red.
🌐
CSS-Tricks
css-tricks.com › almanac › properties › b › border-image
border-image | CSS-Tricks
December 5, 2022 - border-image is a shorthand property that lets you use an image or CSS gradient as the border of an element.
🌐
Neocities
solaria.neocities.org › guides › borderimage
Using and Making CSS Border Images
You can use the CSS property border-image to give a custom border to any element, without having to put it in an additional container.
🌐
Smashing Magazine
smashingmagazine.com › 2024 › 01 › css-border-image-property
The Complex But Awesome CSS border-image Property — Smashing Magazine
January 16, 2024 - There are a few specific aspects of border-image that I think are crucial for understanding how it works. The CSS Backgrounds and Border Module Level 3 specification says border-image should replace any regular border you define, but it’s not always the case.
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › border-image
border-image - CSS - MDN Web Docs - Mozilla
The border-image CSS property draws an image around a given element. It replaces the element's regular border.
🌐
HTML AM
html.am › html-codes › image-codes › html-image-borders.cfm
HTML Image Borders
You create HTML image borders by using Cascading Style Sheets (CSS). Specifically, you use the CSS border property. You can also use other CSS properties to create HTML borders (such as border-width, border-style and border-color), but these don't do anything that border doesn't do.
🌐
Programiz
programiz.com › css › border-image
CSS border-image Property (With Examples)
CSS border-image property sets the image as a border of an element. In this tutorial, you will learn about CSS border-image with the help of examples.
🌐
Cloudinary
cloudinary.com › home › css image border: a practical guide to border-image (and when to scale smarter)
CSS Image Border: A Practical Guide to border-image (and When to Scale Smarter) | Cloudinary
January 14, 2026 - Learn how to add and customize image borders in CSS using border, outline and box-shadow properties. Apply clean, responsive styles to images in modern web layouts.
🌐
W3Docs
w3docs.com › css
How to Add Border to Image in CSS
April 30, 2021 - In this snippet, we will show how to add a border to the image. The <img> element has a border attribute that is not in use in HTML5. So, we recommend using the CSS border property instead.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › border-image-source
border-image-source - CSS - MDN Web Docs
August 5, 2025 - The border-image-source CSS property sets the source image used to create an element's border image.
🌐
W3Schools
w3schools.com › howto › howto_css_border_image.asp
How To Add a Border to an Image
Learn how to add a border around an image. Use the border property to add a border to an <img> element: img { border: 5px solid #555; } Try it Yourself » · Go to our CSS Images Tutorial to learn more about how to style images.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Reference › Properties › border-image-slice
border-image-slice - CSS - MDN Web Docs - Mozilla
December 5, 2025 - The sampled image size is scaled to fit inside the border, which means that if the width is bigger than the slice, the image can start to look somewhat pixelated (unless of course you use an SVG image). ... <div class="wrapper"> <div></div> </div> <ul> <li> <label for="width">slide to adjust <code>border-width</code></label> <input type="range" min="10" max="45" id="width" /> <output id="width-output">30px</output> </li> <li> <label for="slice">slide to adjust <code>border-image-slice</code></label> <input type="range" min="10" max="45" id="slice" /> <output id="slice-output">30</output> </li> </ul>
🌐
OpenReplay
blog.openreplay.com › mastering-border-images-in-css
Mastering Border Images in CSS
July 23, 2025 - The first box demonstrates a classic CSS border: a simple, solid brown line without intricate patterns or designs. The second box replaces the solid border with an image border. The border displays the content of the image.png file around the box, potentially featuring intricate patterns, textures, or designs, depending on the image’s content.
🌐
Border Image
border-image.com › home
Border Image CSS Code Generator - Easy Image Border - Border Image
April 8, 2025 - Basically, a border image property ... how the browser should apply the sections to the edges of the elements. In CSS, is written as, ‘.module { border-image: url(border.png);}’. The property specifies the border image’s source which can either be a data URI, URL, inline SVG ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › css-gradient-borders-pure-css
How To Add Border Images and Gradient Borders with Pure CSS | DigitalOcean
April 8, 2021 - Learn how to use border images and gradients borders with border-image-source and border-image-slice.