aboutsummaryrefslogtreecommitdiff
path: root/build/keynote-slides-css
diff options
context:
space:
mode:
Diffstat (limited to 'build/keynote-slides-css')
-rw-r--r--build/keynote-slides-css/index.html20
1 files changed, 2 insertions, 18 deletions
diff --git a/build/keynote-slides-css/index.html b/build/keynote-slides-css/index.html
index 8ac397d..1c009fa 100644
--- a/build/keynote-slides-css/index.html
+++ b/build/keynote-slides-css/index.html
@@ -3,11 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark light">
<link rel="icon" href="data:,">
<title>Keynote Slides with Pure CSS</title>
<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>
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}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>
@@ -16,25 +17,15 @@
<main>
<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 &#47; keynote slides. You could use native software like LibremOffice Impress, Powerpoint, Apple&#8217;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 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&#8217;s break down each piece:</p>
-
<h2 id="the-html">The HTML</h2>
-
<pre><code>&#60;div class="slider"&#62;
&#60;input type="radio" name="pagination" value="1" checked&#62;
&#60;input type="radio" name="pagination" value="2"&#62;
@@ -59,11 +50,8 @@
&#60;&#47;div&#62;
&#60;&#47;div&#62;
</code></pre>
-
<p>There isn&#8217;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&#8217;t do anything to specifically target each individual slide item - you&#8217;ll see why we don&#8217;t need to in the CSS section!</p>
-
<h2 id="the-css-scss">The CSS (SCSS)</h2>
-
<pre><code>&#47;* Basic default styles *&#47;
.slider {
height: 100%;
@@ -100,17 +88,13 @@ input[type="radio"]:nth-of-type(5):checked ~ .slide:nth-of-type(5) {
.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 &#8220;partner&#8221;. 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&#8217;t be best for extremely long&#47;complex presentation slides</li>
</ul>
-
<p>That&#8217;s it! Hope you enjoy playing around with it.</p>
<footer role="contentinfo">
<h2>Menu Navigation</h2>