From 0684cb60e479f7b60fc5156076a94a8d990f41c5 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Sun, 15 Dec 2024 18:41:41 +0800 Subject: [PATCH] Refactor code snippet for Disability Pride flag background in CSS --- ...23-responsive-disability-pride-flag-css.md | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/blog/posts/2024-07-23-responsive-disability-pride-flag-css.md b/src/blog/posts/2024-07-23-responsive-disability-pride-flag-css.md index b1763d71..3a526410 100644 --- a/src/blog/posts/2024-07-23-responsive-disability-pride-flag-css.md +++ b/src/blog/posts/2024-07-23-responsive-disability-pride-flag-css.md @@ -2,16 +2,23 @@ title: Responsive Disability Pride Flag CSS Background desc: I coded the Disability Pride Flag in CSS to celebrate Disability Pride Month. date: 2024-07-23T20:35:00+0800 +updated: 2024-12-15T18:33:45+0800 categories: ["css", "disability pride"] --- {%- css %} .disability-pride-flag { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='651.83' height='300' viewBox='-90.33 0 651.83 300'%3E%3Cpath fill='%233BB07D' stroke='%233BB07D' stroke-miterlimit='10' stroke-width='.351' d='M561.5 300 162.902.664h-50.634L510.867 300z'/%3E%3Cpath fill='%237BC2E0' stroke='%237BC2E0' stroke-miterlimit='10' stroke-width='.351' d='M510.711 300 112.113.664H61.478L460.078 300z'/%3E%3Cpath fill='%23E8E8E8' stroke='%23E8E8E8' stroke-miterlimit='10' stroke-width='.351' d='M460.077 300 61.478.664H8.094L406.693 300z'/%3E%3Cpath fill='%23EEDE77' stroke='%23EEDE77' stroke-miterlimit='10' stroke-width='.351' d='M406.692 300 8.095.664h-49.111L357.584 300z'/%3E%3Cpath fill='%23CF7280' stroke='%23CF7280' stroke-miterlimit='10' stroke-width='.351' d='M357.378 300-41.22.664h-49.11L308.27 300z'/%3E%3C/svg%3E"); - background-color: #595959; - background-repeat: no-repeat; - background-size: auto 100%; - background-position: center; + background: + linear-gradient( + 37deg, + #595959 0 35%, + #CF7280 30% 41%, + #EEDE77 30% 47%, + #E8E8E8 30% 53%, + #7bc2e0 30% 59%, + #3BB07D 30% 65%, + #595959 0 + ); } .disability-pride-flag.demo { @@ -22,24 +29,32 @@ categories: ["css", "disability pride"]
-Happy [Disability Pride Month](https://en.wikipedia.org/wiki/Disability_Pride_Month)! To celebrate the occasion, I did a small project: a responsive Disability Pride Flag CSS background! For those who do not know, this [Disability Pride Flag](https://www.womansday.com/life/a43964487/disability-pride-flag/) was created by [Ann Magill](https://capri0mni.dreamwidth.org/837596.html) and released in 2021. +Happy [Disability Pride Month](https://en.wikipedia.org/wiki/Disability_Pride_Month)! To celebrate the occasion, I did a small project: a responsive Disability Pride flag CSS background! For those who do not know, this [Disability Pride flag](https://www.womansday.com/life/a43964487/disability-pride-flag/) was created by [Ann Magill](https://capri0mni.dreamwidth.org/837596.html) and released in 2021. + +My Disability Pride flag CSS background is done with a combination of the CSS [`background` property](https://developer.mozilla.org/en-US/docs/Web/CSS/background) and [`linuear-gradient()` function](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient), and designed to be responsive, so it can adapt to different screen sizes and devices. Here is the CSS snippet for a responsive Disability Pride Flag background: ```css .disability-pride-flag { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='651.83' height='300' viewBox='-90.33 0 651.83 300'%3E%3Cpath fill='%233BB07D' stroke='%233BB07D' stroke-miterlimit='10' stroke-width='.351' d='M561.5 300 162.902.664h-50.634L510.867 300z'/%3E%3Cpath fill='%237BC2E0' stroke='%237BC2E0' stroke-miterlimit='10' stroke-width='.351' d='M510.711 300 112.113.664H61.478L460.078 300z'/%3E%3Cpath fill='%23E8E8E8' stroke='%23E8E8E8' stroke-miterlimit='10' stroke-width='.351' d='M460.077 300 61.478.664H8.094L406.693 300z'/%3E%3Cpath fill='%23EEDE77' stroke='%23EEDE77' stroke-miterlimit='10' stroke-width='.351' d='M406.692 300 8.095.664h-49.111L357.584 300z'/%3E%3Cpath fill='%23CF7280' stroke='%23CF7280' stroke-miterlimit='10' stroke-width='.351' d='M357.378 300-41.22.664h-49.11L308.27 300z'/%3E%3C/svg%3E"); - background-color: #595959; - background-repeat: no-repeat; - background-size: auto 100%; - background-position: center; + background: + linear-gradient( + 37deg, + #595959 0 35%, + #CF7280 30% 41%, + #EEDE77 30% 47%, + #E8E8E8 30% 53%, + #7bc2e0 30% 59%, + #3BB07D 30% 65%, + #595959 0 + ); } ``` After copying the above snippet in a CSS stylesheet or the HTML `