Autoscoping (#103)

* Add autoscoping with generated demo

* Remove manual demo from all snippets

* Add JavaScript inside IIFE

* Align mouse-cursor-gradient-tracking.md to demo code

* Match snippets to demo

* Update CONTRIBUTING.md

* Create reusable function for code extraction
This commit is contained in:
atomiks
2018-10-05 09:18:51 +10:00
committed by GitHub
parent 2afb2fe88a
commit 11eff23e47
41 changed files with 107 additions and 1102 deletions

View File

@ -36,32 +36,6 @@ Vertically and horizontally centers a child element within its parent element us
#### Demo
<div class="snippet-demo">
<div class="snippet-demo__container">
<div class="snippet-demo__center">
<span>Centered content</span>
</div>
</div>
</div>
<style>
.snippet-demo__container {
border: 1px solid #333;
height: 250px;
width: 250px;
}
.snippet-demo__center {
display: table;
height: 100%;
width: 100%;
}
.snippet-demo__center > span {
display: table-cell;
text-align: center;
vertical-align: middle;
}
</style>
#### Explanation
1. `display: table` on '.center' allows the element to behave like a `<table>` HTML element.