diff options
author | bt <bt@btxx.org> | 2024-06-08 13:22:19 -0400 |
---|---|---|
committer | bt <bt@btxx.org> | 2024-06-08 13:22:19 -0400 |
commit | dcfb172704f3afb68a30425029ec834be2883274 (patch) | |
tree | 02ac480745db802d7af03f3213a0c568322170e3 /build/keynote-slides-css/index.html | |
parent | e146f8a64c793c337999ce316b16ebe5fe6f2dab (diff) |
More content porting, on-going markdown changes for lowdown support
Diffstat (limited to 'build/keynote-slides-css/index.html')
-rw-r--r-- | build/keynote-slides-css/index.html | 110 |
1 files changed, 64 insertions, 46 deletions
diff --git a/build/keynote-slides-css/index.html b/build/keynote-slides-css/index.html index 45175c6..8ac397d 100644 --- a/build/keynote-slides-css/index.html +++ b/build/keynote-slides-css/index.html @@ -1,56 +1,70 @@ <!doctype html> -<html lang="en" id="top"> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" href="data:,"> <title>Keynote Slides with Pure CSS</title> - <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> - <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style> + <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> + <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" /> +<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style> </head> <nav> - <a href="#menu">Menu ↓</a> + <a href="#menu">Menu ↓</a> </nav> <main> -<h1>Keynote Slides with Pure CSS</h1> +<h1 id="keynote-slides-with-pure-css">Keynote Slides with Pure CSS</h1> + <p>2020-06-22</p> -<p>There are a great deal of options available on the web and built into most operating systems when you need to create presentation / keynote slides. You could use native software like LibremOffice Impress, Powerpoint, Apple's Keynote, etc. You could also decide to use preexisting web-based apps like Google Slides or an open source project such as RevealJS. All of these are good options.</p> + +<p>There are a great deal of options available on the web and built into most operating systems when you need to create presentation / keynote slides. You could use native software like LibremOffice Impress, Powerpoint, Apple’s Keynote, etc. You could also decide to use preexisting web-based apps like Google Slides or an open source project such as RevealJS. All of these are good options.</p> + <p>But thinking more about how overly complex these apps are implemented, it got me wondering if I could quickly code up a presentation slide framework with pure CSS and barely any code.</p> + <p>This is what I came up with:</p> -<h2>The Demo</h2> + +<h2 id="the-demo">The Demo</h2> + <p><a href="https://codepen.io/bradleytaunt/pen/jOWBJZb">Live CodePen Example</a></p> + <p>Yes, I know this is <em>ugly</em>, but this was created as a barebones skeleton for others to build upon. The demo uses a simple set of <code>radio</code> inputs that correspond to their own individual <code>slide</code> element. The framework looks at the currently <code>checked</code> input, then changes the <code>opacity</code> and <code>z-index</code> of its corresponding slide item. Pretty straightforward stuff!</p> -<p>Let's break down each piece:</p> -<h2>The HTML</h2> -<pre><code><div class="slider"> - <input type="radio" name="pagination" value="1" checked> - <input type="radio" name="pagination" value="2"> - <input type="radio" name="pagination" value="3"> - <input type="radio" name="pagination" value="4"> - <input type="radio" name="pagination" value="5"> - - <div class="slide"> - <h2>Slide 1</h2> - </div> - <div class="slide"> - <h2>Slide 2</h2> - </div> - <div class="slide"> - <h2>Slide 3</h2> - </div> - <div class="slide"> - <h2>Slide 4</h2> - </div> - <div class="slide"> - <h2>Slide 5</h2> - </div> -</div> + +<p>Let’s break down each piece:</p> + +<h2 id="the-html">The HTML</h2> + +<pre><code><div class="slider"> + <input type="radio" name="pagination" value="1" checked> + <input type="radio" name="pagination" value="2"> + <input type="radio" name="pagination" value="3"> + <input type="radio" name="pagination" value="4"> + <input type="radio" name="pagination" value="5"> + + <div class="slide"> + <h2>Slide 1</h2> + </div> + <div class="slide"> + <h2>Slide 2</h2> + </div> + <div class="slide"> + <h2>Slide 3</h2> + </div> + <div class="slide"> + <h2>Slide 4</h2> + </div> + <div class="slide"> + <h2>Slide 5</h2> + </div> +</div> </code></pre> -<p>There isn't a whole lot going on here. We are just including a set of <code>radio</code> inputs (based on how many slides are desired) along with their corresponding <code>slide</code> class elements. You might notice we don't do anything to specifically target each individual slide item - you'll see why we don't need to in the CSS section!</p> -<h2>The CSS (SCSS)</h2> -<pre><code>/* Basic default styles */ + +<p>There isn’t a whole lot going on here. We are just including a set of <code>radio</code> inputs (based on how many slides are desired) along with their corresponding <code>slide</code> class elements. You might notice we don’t do anything to specifically target each individual slide item - you’ll see why we don’t need to in the CSS section!</p> + +<h2 id="the-css-scss">The CSS (SCSS)</h2> + +<pre><code>/* Basic default styles */ .slider { height: 100%; left: 0; @@ -67,33 +81,37 @@ } } -input[type="radio"] { cursor: pointer; } +input[type="radio"] { cursor: pointer; } -/* Target slide item based on currently checked radio */ -input[type="radio"]:nth-of-type(1):checked ~ .slide:nth-of-type(1), -input[type="radio"]:nth-of-type(2):checked ~ .slide:nth-of-type(2), -input[type="radio"]:nth-of-type(3):checked ~ .slide:nth-of-type(3), -input[type="radio"]:nth-of-type(4):checked ~ .slide:nth-of-type(4), -input[type="radio"]:nth-of-type(5):checked ~ .slide:nth-of-type(5) { +/* Target slide item based on currently checked radio */ +input[type="radio"]:nth-of-type(1):checked ~ .slide:nth-of-type(1), +input[type="radio"]:nth-of-type(2):checked ~ .slide:nth-of-type(2), +input[type="radio"]:nth-of-type(3):checked ~ .slide:nth-of-type(3), +input[type="radio"]:nth-of-type(4):checked ~ .slide:nth-of-type(4), +input[type="radio"]:nth-of-type(5):checked ~ .slide:nth-of-type(5) { opacity: 1; z-index: 1; } -/* Individual slide styling */ +/* Individual slide styling */ .slide:nth-of-type(1) { background: dodgerblue; } .slide:nth-of-type(2) { background: crimson; } .slide:nth-of-type(3) { background: rebeccapurple; } .slide:nth-of-type(4) { background: goldenrod; } .slide:nth-of-type(5) { background: pink; } </code></pre> -<p>Again, not much to see here. We use CSS to look down through the DOM for each <code>radio</code> elements slide "partner". We do this by targeting the <code>nth-of-type</code> on both elements. Simple stuff.</p> + +<p>Again, not much to see here. We use CSS to look down through the DOM for each <code>radio</code> elements slide “partner”. We do this by targeting the <code>nth-of-type</code> on both elements. Simple stuff.</p> + <p>Some drawbacks to this approach:</p> + <ul> <li>You need to manually target each new slide you add (color, styling, content, etc.)</li> <li>Lack of animations might require extra work to implement (maybe 3rd party libraries- ke AOS?)</li> -<li>Probably won't be best for extremely long/complex presentation slides</li> +<li>Probably won’t be best for extremely long/complex presentation slides</li> </ul> -<p>That's it! Hope you enjoy playing around with it.</p> + +<p>That’s it! Hope you enjoy playing around with it.</p> <footer role="contentinfo"> <h2>Menu Navigation</h2> <ul id="menu"> |