{"id":39754,"date":"2026-01-24T03:55:27","date_gmt":"2026-01-24T11:55:27","guid":{"rendered":"https:\/\/cloudinary.com\/blog\/?p=39754"},"modified":"2026-01-24T03:55:28","modified_gmt":"2026-01-24T11:55:28","slug":"how-can-developers-create-custom-borders-for-images-using-css","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/","title":{"rendered":"How can developers create custom borders for images using CSS?"},"content":{"rendered":"\n<p>You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community often asks for a reliable way to do this that scales across devices and is easy to maintain.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Question:<\/h2>\n\n\n\n<p><em>Hi folks,<\/em><br><em>I need to style image cards with more than plain 1px borders. I am looking for approaches that let me add rounded, multi-layer, gradient, or even image-based frames that scale responsively. How can developers create custom borders for images using CSS? I am also curious about pros and cons of different techniques and how to keep everything sharp on high DPI screens. Any code examples and pitfalls to avoid would be great.<\/em><\/p>\n\n\n\n<p><em>Thanks!<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Answer:<\/h2>\n\n\n\n<p>There are several solid approaches, each with different tradeoffs in flexibility, visual fidelity, and complexity. Below are the most common techniques plus examples you can adapt quickly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1) Classic border and border-radius<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\"><span class=\"hljs-selector-tag\">img<\/span><span class=\"hljs-selector-class\">.framed<\/span> {\n\u00a0 <span class=\"hljs-attribute\">display<\/span>: block;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-comment\">\/* remove inline gaps *\/<\/span>\n\u00a0 <span class=\"hljs-attribute\">border<\/span>: <span class=\"hljs-number\">8px<\/span> solid <span class=\"hljs-number\">#222<\/span>;\u00a0 <span class=\"hljs-comment\">\/* thickness + color *\/<\/span>\n\u00a0 <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">16px<\/span>; \u00a0 \u00a0 <span class=\"hljs-comment\">\/* rounded corners *\/<\/span>\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This is the simplest solution and supports rounded corners, but not textures or patterns.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2) Gradient borders using background-clip trick<\/h3>\n\n\n\n<p>Wrap the image with a container that paints a gradient, then reveal it as the border.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"gradient-border\"<\/span>&gt;<\/span>\n\u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"photo.jpg\"<\/span> <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">\"Decorated\"<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n.gradient-border {\n\u00a0 display: inline-block;\n\u00a0 padding: 6px; \/* border thickness *\/\n\u00a0 border-radius: 16px;\n\u00a0 background: linear-gradient(135deg, #7f5af0, #2cb67d);\n}\n.gradient-border img {\n\u00a0 display: block;\n\u00a0 border-radius: 12px;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">3) Multiple borders with box-shadow<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\"><span class=\"hljs-selector-tag\">img<\/span><span class=\"hljs-selector-class\">.double-border<\/span> {\n\u00a0 <span class=\"hljs-attribute\">display<\/span>: block;\n\u00a0 <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">12px<\/span>;\n\u00a0 <span class=\"hljs-attribute\">box-shadow<\/span>:\n\u00a0 \u00a0 <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">6px<\/span> <span class=\"hljs-number\">#fff<\/span>, \u00a0 <span class=\"hljs-comment\">\/* inner border *\/<\/span>\n\u00a0 \u00a0 <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">12px<\/span> <span class=\"hljs-number\">#111<\/span>;\u00a0 <span class=\"hljs-comment\">\/* outer border *\/<\/span>\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Useful for layered frames without extra wrappers. Each spread simulates a border ring.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4) Image-based frames with border-image<\/h3>\n\n\n\n<p>Use a PNG or SVG as a 9-slice border that wraps around the image. This is perfect for decorative corners.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\"><span class=\"hljs-selector-tag\">img<\/span><span class=\"hljs-selector-class\">.frame<\/span> {\n\u00a0 <span class=\"hljs-attribute\">border<\/span>: <span class=\"hljs-number\">24px<\/span> solid transparent;\u00a0 \u00a0 \u00a0 <span class=\"hljs-comment\">\/* reserve space *\/<\/span>\n\u00a0 <span class=\"hljs-attribute\">border-image-source<\/span>: <span class=\"hljs-built_in\">url<\/span>(<span class=\"hljs-string\">'corner-frame.svg'<\/span>);\n\u00a0 <span class=\"hljs-attribute\">border-image-slice<\/span>: <span class=\"hljs-number\">30<\/span> fill; \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-comment\">\/* controls the 9-slice cut *\/<\/span>\n\u00a0 <span class=\"hljs-attribute\">border-image-width<\/span>: <span class=\"hljs-number\">24px<\/span>;\n\u00a0 <span class=\"hljs-attribute\">border-image-repeat<\/span>: round;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"hljs-comment\">\/* round to avoid stretching artifacts *\/<\/span>\n\u00a0 <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">12px<\/span>;\n\u00a0 <span class=\"hljs-attribute\">box-sizing<\/span>: border-box;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Prefer SVG for crisp scaling across DPIs. If you are choosing between raster and vector, this guide helps: <a href=\"https:\/\/cloudinary.com\/guides\/image-formats\/svg-vs-png-4-key-differences-and-how-to-choose\">SVG vs PNG<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5) Decorative frames with pseudo-elements<\/h3>\n\n\n\n<p>Paint complex frames using <code>::before<\/code> or <code>::after<\/code> so you don\u2019t touch the image element itself.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">figure<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"card\"<\/span>&gt;<\/span>\n\u00a0 <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"photo.jpg\"<\/span> <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">\"Card\"<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">figure<\/span>&gt;<\/span>\n\n.card {\n\u00a0 position: relative;\n\u00a0 display: inline-block;\n\u00a0 border-radius: 14px;\n}\n.card::before {\n\u00a0 content: \"\";\n\u00a0 position: absolute;\n\u00a0 top: -8px; right: -8px; bottom: -8px; left: -8px;\n\u00a0 border-radius: 18px;\n\u00a0 background:\n\u00a0 \u00a0 repeating-linear-gradient(45deg, #0ea5e9 0 10px, #22c55e 10px 20px);\n\u00a0 z-index: -1; \/* sits behind the image *\/\n}\n.card img { display: block; border-radius: 12px; }<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This approach is great for dynamic patterns and themes driven by CSS variables.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6) Masking or clipping for non-rectangular frames<\/h3>\n\n\n\n<p>For badge-like or ornamental shapes, use CSS <code>clip-path<\/code> or <code>mask-image<\/code>. You can mask a gradient or pattern to show as the border area only. This is more advanced but powerful for brand motifs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Format and responsiveness tips<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Prefer SVG for border assets to keep borders sharp at any size.<\/li>\n\n\n\n<li>Use <code>object-fit: cover<\/code> and responsive widths to avoid distorted images inside frames.<\/li>\n\n\n\n<li>Avoid heavy raster border PNGs. If you must use them, optimize aggressively.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Enhancing or offloading the work with Cloudinary<\/h3>\n\n\n\n<p>After you pick a CSS technique, you can manage and transform your images in the delivery layer. For overlays and frames, Cloudinary can generate or apply borders at URL time, and you can still combine them with your CSS borders.<\/p>\n\n\n\n<p>Solid border and rounded corners on delivery:<\/p>\n\n\n\n<p><code>https:\/\/res.cloudinary.com\/demo\/image\/upload\/f_auto,q_auto,w_600,c_fill,g_auto,bo_12px_solid_rgb:2cb67d,r_16\/sample.jpg<\/code><\/p>\n\n\n\n<p>Add a frame overlay image that scales to the base:<\/p>\n\n\n\n<p><code>https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_600,c_fill,g_auto,f_auto,q_auto\/l_my_frame.png,fl_relative,w_1.0\/r_12\/sample.jpg<\/code><\/p>\n\n\n\n<p>This lets you standardize borders server-side and keep your CSS simpler while still using the same HTML element. Learn overlay concepts here: <a href=\"https:\/\/cloudinary.com\/guides\/image-effects\/how-to-overlay-a-picture-on-a-picture\">How to overlay a picture on a picture<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common pitfalls<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For border-image, ensure the slice matches the asset\u2019s corner thickness or corners will stretch.<\/li>\n\n\n\n<li>Set <code>box-sizing: border-box<\/code> when borders affect sizing within layout grids.<\/li>\n\n\n\n<li>Test on high DPI devices. If using raster frames, export 2x or 3x variants or prefer SVG.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">TL;DR<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For simple rounded borders, use border and border-radius.<\/li>\n\n\n\n<li>For gradients and multi-layer styles, use a wrapper with background-clip and box-shadow.<\/li>\n\n\n\n<li>For decorative corners and textures, use border-image with SVG.<\/li>\n\n\n\n<li>For complex art, use pseudo-elements or masks. Optionally offload framing to Cloudinary with URL transformations and overlays.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Learn More<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/cloudinary.com\/tools\/png-to-webp\">PNG to WebP Converter<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudinary.com\/tools\/image-upscale\">Image Upscaling and Quality Enhancement<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudinary.com\/background-remover\">Background Remover<\/a><\/li>\n<\/ul>\n\n\n\n<p>Ready to streamline image delivery and apply borders, overlays, and optimization on the fly? <a href=\"https:\/\/cloudinary.com\/users\/register_free\">Sign up for a free Cloudinary account<\/a> and start building faster.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community often asks for a reliable way to do this that scales across devices and is easy to maintain.&nbsp; Question: Hi folks,I need to style image cards with more than [&hellip;]<\/p>\n","protected":false},"author":88,"featured_media":39726,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[423],"class_list":["post-39754","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-questions"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How can developers create custom borders for images using CSS?<\/title>\n<meta name=\"description\" content=\"You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How can developers create custom borders for images using CSS?\" \/>\n<meta property=\"og:description\" content=\"You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-24T11:55:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-24T11:55:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"damjanantevski\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/\"},\"author\":{\"name\":\"damjanantevski\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/43592e43c12520a1e867d456b1e8cf7e\"},\"headline\":\"How can developers create custom borders for images using CSS?\",\"datePublished\":\"2026-01-24T11:55:27+00:00\",\"dateModified\":\"2026-01-24T11:55:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/\"},\"wordCount\":588,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA\",\"keywords\":[\"Questions\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2026\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/\",\"url\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/\",\"name\":\"How can developers create custom borders for images using CSS?\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA\",\"datePublished\":\"2026-01-24T11:55:27+00:00\",\"dateModified\":\"2026-01-24T11:55:28+00:00\",\"description\":\"You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA\",\"width\":1200,\"height\":630,\"caption\":\"CSS featured image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How can developers create custom borders for images using CSS?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/43592e43c12520a1e867d456b1e8cf7e\",\"name\":\"damjanantevski\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3b40c995531fe4d510212a06c9d4fc666d2cb8efbfebc98a94191701accf4817?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3b40c995531fe4d510212a06c9d4fc666d2cb8efbfebc98a94191701accf4817?s=96&d=mm&r=g\",\"caption\":\"damjanantevski\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How can developers create custom borders for images using CSS?","description":"You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/","og_locale":"en_US","og_type":"article","og_title":"How can developers create custom borders for images using CSS?","og_description":"You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community","og_url":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/","og_site_name":"Cloudinary Blog","article_published_time":"2026-01-24T11:55:27+00:00","article_modified_time":"2026-01-24T11:55:28+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA","type":"image\/jpeg"}],"author":"damjanantevski","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/"},"author":{"name":"damjanantevski","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/43592e43c12520a1e867d456b1e8cf7e"},"headline":"How can developers create custom borders for images using CSS?","datePublished":"2026-01-24T11:55:27+00:00","dateModified":"2026-01-24T11:55:28+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/"},"wordCount":588,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA","keywords":["Questions"],"inLanguage":"en-US","copyrightYear":"2026","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/","url":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/","name":"How can developers create custom borders for images using CSS?","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA","datePublished":"2026-01-24T11:55:27+00:00","dateModified":"2026-01-24T11:55:28+00:00","description":"You have a grid of product shots or profile avatars and you want them to pop with decorative frames, gradient strokes, or playful patterns. The community","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA","width":1200,"height":630,"caption":"CSS featured image"},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/questions\/how-can-developers-create-custom-borders-for-images-using-css\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How can developers create custom borders for images using CSS?"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/43592e43c12520a1e867d456b1e8cf7e","name":"damjanantevski","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3b40c995531fe4d510212a06c9d4fc666d2cb8efbfebc98a94191701accf4817?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3b40c995531fe4d510212a06c9d4fc666d2cb8efbfebc98a94191701accf4817?s=96&d=mm&r=g","caption":"damjanantevski"}}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1769222068\/css_featured_image\/css_featured_image.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/39754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/88"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=39754"}],"version-history":[{"count":1,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/39754\/revisions"}],"predecessor-version":[{"id":39755,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/39754\/revisions\/39755"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/39726"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=39754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=39754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=39754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}