{"id":29277,"date":"2017-02-20T21:01:34","date_gmt":"2017-02-20T13:01:34","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=29277"},"modified":"2025-04-03T23:46:48","modified_gmt":"2025-04-03T15:46:48","slug":"css-only-image-reveal-effect","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/","title":{"rendered":"Create CSS-Only Image Reveal Effect with Transparent Borders"},"content":{"rendered":"<p>A <strong>CSS-only image reveal effect<\/strong> can be solved in different ways. It\u2019s actually quite easy to code a design in which the <strong>image stands out of<\/strong> (is overflown by) <strong>its solid background<\/strong> \u2014you just <strong>place an image<\/strong> over a smaller element with a solid background.<\/p>\n<p>You can get the same result if you use <strong>transparent borders<\/strong>, where you keep the <strong>size of the background element the same<\/strong> as that of the foreground and add transparent borders in order to <strong>create an empty space<\/strong> for the foreground to overflow into.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/css-cutout-border\/\">How to Create a Cut-out Border Design with CSS<\/a>\n\t\t\t\t<\/p>\n<p>There are <strong>some advantages in using the latter method<\/strong>. Since it\u2019s the transparent borders that provide the area for the foreground to overflow into, we can <strong>control the direction of the overflow<\/strong> between the left, right, top and bottom borders. Also, having the same size for both the foreground and the background <strong>makes it easier to move both elements simultaneously<\/strong> across the page.<\/p>\n<p>In a nutshell, we\u2019re going to see how to <strong>create a CSS-only image reveal effect<\/strong> using a <strong>smaller solid background<\/strong> with a <strong>foreground image that has transparent borders<\/strong>. You can check out the <strong>final demo<\/strong> below.<\/p>\n<p><iframe height=\"442\" scrolling=\"no\" title=\"CSS-Only Image Reveal Effect\" src=\"https:\/\/codepen.io\/\/hkdc\/embed\/ygWMpe\/?height=442&theme-id=0&default-tab=result&embed-version=2\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" style=\"width: 100%;\">See the Pen <a href=\"https:\/\/codepen.io\/\/hkdc\/pen\/ygWMpe\/\" rel=\"nofollow\">CSS-Only Image Reveal Effect<\/a> by HONGKIAT (<a href=\"https:\/\/codepen.io\/\/hkdc\" rel=\"nofollow\">@hkdc<\/a>) on <a href=\"https:\/\/codepen.io\/\" rel=\"nofollow\">CodePen<\/a>. <\/iframe><\/p>\n<h2>1. Create the initial code<\/h2>\n<pre>\r\n&lt;div class=foo&gt;&lt;\/div&gt;\r\n<\/pre>\n<p>In the CSS, we use <strong>two CSS variables<\/strong>, <code>--bgc<\/code> and <code>--dim<\/code> for the <strong>background colour<\/strong> and the <strong>dimensions<\/strong> of the <code>.foo<\/code> container, respectively. In the example, I used the <strong>same value<\/strong> for the width and height to get a square-shaped box, create <strong>separate variables<\/strong> for the height and the width if you want a rectangular.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/css-variables\/\">A Look Into: Using CSS Variables<\/a>\n\t\t\t\t<\/p>\n<p>We also add the <code>position:relative<\/code> rule to <code>.foo<\/code>, so that its pseudo-elements, that we\u2019re gonna use for <strong>revealing the image<\/strong>, can be <strong>absolutely positioned<\/strong> (see below), and thus <strong>stacked upon each other<\/strong>.<\/p>\n<pre>\r\n.foo {\r\n    --bgc: #FFCC03;\r\n    --dim: 300px;\r\n    width: var(--dim);\r\n    height: var(--dim);\r\n    background-color: var(--bgc);\r\n    position: relative;\r\n}\r\n<\/pre>\n<p>We <strong>add an empty <code>content<\/code> property<\/strong> to both pseudo-elements, <code>.foo::before<\/code> and <code>.foo::after<\/code>, to get them properly rendered.<\/p>\n<pre>\r\n.foo::before,\r\n.foo::after{\r\n    content: '';\r\n    position: absolute;\r\n    left: 0;\r\n    top: 0;\r\n}\r\n<\/pre>\n<p>The <code>.foo<\/code> element, its two pseudo-elements, <code>.foo::before<\/code>, <code>.foo::after<\/code>, and their <code>:hover<\/code> pseudo-classes <strong>get a <code>transition<\/code> property<\/strong> that will <strong>add an ease-in transition<\/strong> to them for 500 milliseconds (half a second).<\/p>\n<pre>\r\n.foo,\r\n.foo:hover,\r\n.foo::before,\r\n.foo::after,\r\n.foo:hover::before,\r\n.foo:hover::after {\r\n    transition: transform 500ms ease-in;\r\n}\r\n<\/pre>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/pseudo-element-before-after\/\">Understanding Pseudo-Element :before and :after<\/a>\n\t\t\t\t<\/p>\n<h2>2. Add the image<\/h2>\n<p>We add the image to the <code>.foo::before<\/code> pseudo-element <strong>as a background image<\/strong>, and <strong>size it to cover the whole pseudo-element<\/strong> with the <code>width<\/code> and <code>height<\/code> properties. We <strong>stack it right beneath the <code>.foo<\/code> element<\/strong> using the <code>z-index: -1<\/code> rule.<\/p>\n<pre>\r\n.foo::before {\r\n    width: 100%;\r\n    height: 100%;\r\n    background: url(camel.png) center\/cover;\r\n    z-index: -1;\r\n}\r\n<\/pre>\n<p>The <code>center<\/code> keyword <strong>centres the image<\/strong>, while the <code>cover<\/code> keyword scales the image to <strong>cover the entire element<\/strong> while maintaining its aspect ratio.<\/p>\n<p>On the <strong>screenshot below<\/strong> you can see what we have so far (<code>z-index<\/code> is removed from <code>.foo::before<\/code> so that it can be seen):<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg-img.jpg\" alt=\"Background image with the initial code\" width=\"800\" height=\"482\"><\/figure>\n<h2>3. Add the slide-out background<\/h2>\n<p>To add the <strong>smaller (slide-out) background behind the image<\/strong>, we\u2019ll use the other pseudo-element, <code>.foo::after<\/code>.<\/p>\n<p>We create another CSS variable, <code>--b<\/code>, for the <strong>border width<\/strong>. We give <strong>three transparent borders<\/strong> to the <code>::after<\/code> pseudo-element: <strong>top, right, and bottom<\/strong>.<\/p>\n<pre>\r\n.foo::after {\r\n    --b: 20px;\r\n    width: calc(100% - var(--b));\r\n    height: calc(100% - calc(var(--b) * 2));\r\n    border: var(--b) solid transparent;\r\n    border-left: none;\r\n    box-shadow: inset 0 var(--dim) 0 var(--bgc);\r\n    filter: brightness(.8);\r\n    z-index: -2;\r\n}\r\n<\/pre>\n<p>The <strong>width<\/strong> is calculated as <code>calc(100% - var--b))<\/code> that returns <strong>the total width of <code>.foo<\/code> minus the total width of its horizontal borders<\/strong> (right border only, since there\u2019s not left border).<\/p>\n<p>The <strong>height<\/strong> is calculated as <code>calc(100% - calc(var(--b) * 2))<\/code> that returns <strong>the total height of <code>.foo<\/code> minus the total width of its vertical borders<\/strong> (top and bottom borders).<\/p>\n<p>With the <code>box-shadow<\/code> property, we also <strong>add a horizontal inset shadow<\/strong> of the size same as <code>.foo<\/code> (which is <code>var(--dim)<\/code>).<\/p>\n<p>A CSS filter of <code>brightness(.8)<\/code> <strong>darkens the background colour<\/strong> a little bit, and finally, the <code>z-index: -2<\/code> rule <strong>places the <code>::after<\/code> pseudo-element underneath <code>::before<\/code><\/strong> that contains the image.<\/p>\n<p>Here\u2019s the <strong>screenshot of the demo<\/strong> rendered so far (with <code>z-index<\/code> removed from both pseudo-elements so they can be seen):<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg.jpg\" alt=\"Div and its two pseudo-elements stacked\" width=\"800\" height=\"486\"><\/figure>\n<h2>4. Add the transformation<\/h2>\n<p>We <strong>add the <code>transform<\/code> property<\/strong> to the two pseudo-elements, so when the user hovers over <code>.foo<\/code>, both pseudo-elements are <strong>moved horizontally<\/strong>.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/css3-2d-transformation\/\">A Look Into: CSS3 2D Transformations<\/a>\n\t\t\t\t<\/p>\n<p>As we <strong>already added the <code>transition<\/code> property to all elements<\/strong> at the end of Step 1, the movement of the image and its background are <strong>both animated<\/strong>.<\/p>\n<pre>\r\n.foo:hover::before,\r\n.foo:hover::after {\r\n    transform: translateX(100%);\r\n}\r\n<\/pre>\n<p>Below, you can see the <strong>final demo<\/strong>.<\/p>\n<p><iframe height=\"442\" scrolling=\"no\" title=\"CSS-Only Image Reveal Effect\" src=\"https:\/\/codepen.io\/\/hkdc\/embed\/ygWMpe\/?height=442&theme-id=0&default-tab=result&embed-version=2\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" style=\"width: 100%;\">See the Pen <a href=\"https:\/\/codepen.io\/\/hkdc\/pen\/ygWMpe\/\" rel=\"nofollow\">CSS-Only Image Reveal Effect<\/a> by HONGKIAT (<a href=\"https:\/\/codepen.io\/\/hkdc\" rel=\"nofollow\">@hkdc<\/a>) on <a href=\"https:\/\/codepen.io\/\" rel=\"nofollow\">CodePen<\/a>. <\/iframe><\/p>\n<h2>Bonus: Optional margin<\/h2>\n<p>If you display <code>.foo<\/code> <strong>next to other elements<\/strong> on a page and want these other elements to <strong>move away<\/strong> when the image and its background slides out, then <strong>add a right\n  margin of the same width as that of <code>.foo<\/code><\/strong> to the <code>.foo:hover<\/code> element.<\/p>\n<pre>\r\n.foo:hover {\r\n    margin-right: var(--dim);\r\n}\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>A CSS-only image reveal effect can be solved in different ways. It\u2019s actually quite easy to code a design in which the image stands out of (is overflown by) its solid background \u2014you just place an image over a smaller element with a solid background. You can get the same result if you use transparent&hellip;<\/p>\n","protected":false},"author":145,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[507,4501],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Create CSS-Only Image Reveal Effect with Transparent Borders - Hongkiat<\/title>\n<meta name=\"description\" content=\"A CSS-only image reveal effect can be solved in different ways. It&#039;s actually quite easy to code a design in which the image stands out of (is overflown\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create CSS-Only Image Reveal Effect with Transparent Borders\" \/>\n<meta property=\"og:description\" content=\"A CSS-only image reveal effect can be solved in different ways. It&#039;s actually quite easy to code a design in which the image stands out of (is overflown\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-20T13:01:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T15:46:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg-img.jpg\" \/>\n<meta name=\"author\" content=\"Preethi Ranjit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Preethi Ranjit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/\"},\"author\":{\"name\":\"Preethi Ranjit\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\"},\"headline\":\"Create CSS-Only Image Reveal Effect with Transparent Borders\",\"datePublished\":\"2017-02-20T13:01:34+00:00\",\"dateModified\":\"2025-04-03T15:46:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/\"},\"wordCount\":683,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-image-reveal-effect\\\/small-solid-bg-img.jpg\",\"keywords\":[\"CSS\",\"CSS Tutorials\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/\",\"name\":\"Create CSS-Only Image Reveal Effect with Transparent Borders - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-image-reveal-effect\\\/small-solid-bg-img.jpg\",\"datePublished\":\"2017-02-20T13:01:34+00:00\",\"dateModified\":\"2025-04-03T15:46:48+00:00\",\"description\":\"A CSS-only image reveal effect can be solved in different ways. It's actually quite easy to code a design in which the image stands out of (is overflown\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-image-reveal-effect\\\/small-solid-bg-img.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-image-reveal-effect\\\/small-solid-bg-img.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-image-reveal-effect\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create CSS-Only Image Reveal Effect with Transparent Borders\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\",\"name\":\"Preethi Ranjit\",\"description\":\"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/preethi\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Create CSS-Only Image Reveal Effect with Transparent Borders - Hongkiat","description":"A CSS-only image reveal effect can be solved in different ways. It's actually quite easy to code a design in which the image stands out of (is overflown","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:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/","og_locale":"en_US","og_type":"article","og_title":"Create CSS-Only Image Reveal Effect with Transparent Borders","og_description":"A CSS-only image reveal effect can be solved in different ways. It's actually quite easy to code a design in which the image stands out of (is overflown","og_url":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2017-02-20T13:01:34+00:00","article_modified_time":"2025-04-03T15:46:48+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg-img.jpg","type":"","width":"","height":""}],"author":"Preethi Ranjit","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Preethi Ranjit","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/"},"author":{"name":"Preethi Ranjit","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3"},"headline":"Create CSS-Only Image Reveal Effect with Transparent Borders","datePublished":"2017-02-20T13:01:34+00:00","dateModified":"2025-04-03T15:46:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/"},"wordCount":683,"commentCount":1,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg-img.jpg","keywords":["CSS","CSS Tutorials"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/","url":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/","name":"Create CSS-Only Image Reveal Effect with Transparent Borders - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg-img.jpg","datePublished":"2017-02-20T13:01:34+00:00","dateModified":"2025-04-03T15:46:48+00:00","description":"A CSS-only image reveal effect can be solved in different ways. It's actually quite easy to code a design in which the image stands out of (is overflown","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg-img.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-only-image-reveal-effect\/small-solid-bg-img.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-image-reveal-effect\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create CSS-Only Image Reveal Effect with Transparent Borders"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3","name":"Preethi Ranjit","description":"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.","url":"https:\/\/www.hongkiat.com\/blog\/author\/preethi\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-7Cd","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/145"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=29277"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29277\/revisions"}],"predecessor-version":[{"id":73469,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29277\/revisions\/73469"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=29277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=29277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=29277"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=29277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}