From 65942ada584867bd3de95131ae29c72a3a744bff Mon Sep 17 00:00:00 2001
From: 30secondsofcode <30secondsofcode@gmail.com>
Date: Thu, 17 Oct 2019 20:39:22 +0000
Subject: [PATCH] Travis build: 525
---
README.md | 47 +++++++++++++++++++++++++++++++++++
snippet_data/snippetList.json | 15 +++++++++++
snippet_data/snippets.json | 27 ++++++++++++++++++++
3 files changed, 89 insertions(+)
diff --git a/README.md b/README.md
index d815025d5..66caf4cdd 100644
--- a/README.md
+++ b/README.md
@@ -109,6 +109,7 @@ See CONTRIBUTING.md for the snippet template.
* [`Shape separator`](#shape-separator)
* [`System font stack`](#system-font-stack)
* [`Toggle switch`](#toggle-switch)
+* [`Transform - Detransform`](#transform---detransform)
* [`Triangle`](#triangle)
* [`Zebra striped list`](#zebra-striped-list)
@@ -2636,6 +2637,52 @@ input[type='checkbox']:checked + .switch {
[⬆ Back to top](#contents)
+### Transform - Detransform
+
+Sets a transform on the parent element and de-transforms the child elements, so they are not affected by the transform.
+This allows for some neat effects such as skewed buttons.
+
+```html
+
+```
+
+```css
+:root {
+ --transform: 10deg;
+}
+
+.parent {
+ transform: skewX(var(--transform));
+ padding: 1rem;
+ border: 1px solid;
+ display: inline-block;
+}
+
+.child {
+ transform: skewX(calc(-1 * var(--transform)));
+}
+```
+
+
+#### Explanation
+
+
+- `--transform: 10deg` sets a CSS variable we can later use to prevent duplicate code.
+- `calc(-1 * var(--transform))` on the child element negates the transform from the parent.
+
+- Note: the `display` property of the child element may not be `inline`, otherwise the transform will be ignored ([see also](https://drafts.csswg.org/css-transforms-1/#terminology)).
+
+
+#### Browser support
+
+100.0%
+
+⚠️ Requires prefix for full support.
+
+- https://caniuse.com/#feat=transforms2d
+
+
[⬆ Back to top](#contents)
+
### Triangle
Creates a triangle shape with pure CSS.
diff --git a/snippet_data/snippetList.json b/snippet_data/snippetList.json
index 1b9e5b455..e70e5e3b7 100644
--- a/snippet_data/snippetList.json
+++ b/snippet_data/snippetList.json
@@ -699,6 +699,21 @@
"hash": "9ee4bb8713d24b9e6f5367eb05645c6e41d205b120b4d06a9a949984c7cd73b0"
}
},
+ {
+ "id": "transform-detransform",
+ "type": "snippetListing",
+ "title": "Transform - Detransform",
+ "attributes": {
+ "text": "Sets a transform on the parent element and de-transforms the child elements, so they are not affected by the transform.\nThis allows for some neat effects such as skewed buttons.\n\n",
+ "tags": [
+ "visual",
+ "beginner"
+ ]
+ },
+ "meta": {
+ "hash": "3d669f655ec92a355b355d2d35e6e9262ad582671abac860d7170893ac68e467"
+ }
+ },
{
"id": "triangle",
"type": "snippetListing",
diff --git a/snippet_data/snippets.json b/snippet_data/snippets.json
index 11060a718..a35331e8a 100644
--- a/snippet_data/snippets.json
+++ b/snippet_data/snippets.json
@@ -1287,6 +1287,33 @@
"hash": "9ee4bb8713d24b9e6f5367eb05645c6e41d205b120b4d06a9a949984c7cd73b0"
}
},
+ {
+ "id": "transform-detransform",
+ "title": "Transform - Detransform",
+ "type": "snippet",
+ "attributes": {
+ "fileName": "transform-detransform.md",
+ "text": "Sets a transform on the parent element and de-transforms the child elements, so they are not affected by the transform.\nThis allows for some neat effects such as skewed buttons.\n\n",
+ "explanation": "\n\n- `--transform: 10deg` sets a CSS variable we can later use to prevent duplicate code.\n- `calc(-1 * var(--transform))` on the child element negates the transform from the parent.\n\n- Note: the `display` property of the child element may not be `inline`, otherwise the transform will be ignored ([see also](https://drafts.csswg.org/css-transforms-1/#terminology)).\n\n",
+ "browserSupport": {
+ "text": "\n\n⚠️ Requires prefix for full support.\n\n- https://caniuse.com/#feat=transforms2d\n",
+ "supportPercentage": 100
+ },
+ "codeBlocks": {
+ "html": "",
+ "css": ":root {\n --transform: 10deg;\n}\n\n.parent {\n transform: skewX(var(--transform));\n padding: 1rem;\n border: 1px solid;\n display: inline-block;\n}\n\n.child {\n transform: skewX(calc(-1 * var(--transform)));\n}",
+ "js": "",
+ "scopedCss": "[data-scope=\"transform-detransform\"] :root {\n --transform: 10deg; }\n\n[data-scope=\"transform-detransform\"] .parent {\n transform: skewX(var(--transform));\n padding: 1rem;\n border: 1px solid;\n display: inline-block; }\n\n[data-scope=\"transform-detransform\"] .child {\n transform: skewX(calc(-1 * var(--transform))); }\n"
+ },
+ "tags": [
+ "visual",
+ "beginner"
+ ]
+ },
+ "meta": {
+ "hash": "3d669f655ec92a355b355d2d35e6e9262ad582671abac860d7170893ac68e467"
+ }
+ },
{
"id": "triangle",
"title": "Triangle",