aboutsummaryrefslogtreecommitdiff
path: root/build/keynote-slides-css/index.html
diff options
context:
space:
mode:
authorbt <bt@btxx.org>2024-06-08 13:22:19 -0400
committerbt <bt@btxx.org>2024-06-08 13:22:19 -0400
commitdcfb172704f3afb68a30425029ec834be2883274 (patch)
tree02ac480745db802d7af03f3213a0c568322170e3 /build/keynote-slides-css/index.html
parente146f8a64c793c337999ce316b16ebe5fe6f2dab (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.html110
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 &darr;</a>
+ <a href="#menu">Menu &darr;</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 &#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>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>&lt;div class=&quot;slider&quot;&gt;
- &lt;input type=&quot;radio&quot; name=&quot;pagination&quot; value=&quot;1&quot; checked&gt;
- &lt;input type=&quot;radio&quot; name=&quot;pagination&quot; value=&quot;2&quot;&gt;
- &lt;input type=&quot;radio&quot; name=&quot;pagination&quot; value=&quot;3&quot;&gt;
- &lt;input type=&quot;radio&quot; name=&quot;pagination&quot; value=&quot;4&quot;&gt;
- &lt;input type=&quot;radio&quot; name=&quot;pagination&quot; value=&quot;5&quot;&gt;
-
- &lt;div class=&quot;slide&quot;&gt;
- &lt;h2&gt;Slide 1&lt;/h2&gt;
- &lt;/div&gt;
- &lt;div class=&quot;slide&quot;&gt;
- &lt;h2&gt;Slide 2&lt;/h2&gt;
- &lt;/div&gt;
- &lt;div class=&quot;slide&quot;&gt;
- &lt;h2&gt;Slide 3&lt;/h2&gt;
- &lt;/div&gt;
- &lt;div class=&quot;slide&quot;&gt;
- &lt;h2&gt;Slide 4&lt;/h2&gt;
- &lt;/div&gt;
- &lt;div class=&quot;slide&quot;&gt;
- &lt;h2&gt;Slide 5&lt;/h2&gt;
- &lt;/div&gt;
-&lt;/div&gt;
+
+<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;
+ &#60;input type="radio" name="pagination" value="3"&#62;
+ &#60;input type="radio" name="pagination" value="4"&#62;
+ &#60;input type="radio" name="pagination" value="5"&#62;
+
+ &#60;div class="slide"&#62;
+ &#60;h2&#62;Slide 1&#60;&#47;h2&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="slide"&#62;
+ &#60;h2&#62;Slide 2&#60;&#47;h2&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="slide"&#62;
+ &#60;h2&#62;Slide 3&#60;&#47;h2&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="slide"&#62;
+ &#60;h2&#62;Slide 4&#60;&#47;h2&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="slide"&#62;
+ &#60;h2&#62;Slide 5&#60;&#47;h2&#62;
+ &#60;&#47;div&#62;
+&#60;&#47;div&#62;
</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&#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%;
left: 0;
@@ -67,33 +81,37 @@
}
}
-input[type=&quot;radio&quot;] { cursor: pointer; }
+input[type="radio"] { cursor: pointer; }
-/* Target slide item based on currently checked radio */
-input[type=&quot;radio&quot;]:nth-of-type(1):checked ~ .slide:nth-of-type(1),
-input[type=&quot;radio&quot;]:nth-of-type(2):checked ~ .slide:nth-of-type(2),
-input[type=&quot;radio&quot;]:nth-of-type(3):checked ~ .slide:nth-of-type(3),
-input[type=&quot;radio&quot;]:nth-of-type(4):checked ~ .slide:nth-of-type(4),
-input[type=&quot;radio&quot;]:nth-of-type(5):checked ~ .slide:nth-of-type(5) {
+&#47;* Target slide item based on currently checked radio *&#47;
+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 */
+&#47;* Individual slide styling *&#47;
.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 &#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't be best for extremely long/complex presentation slides</li>
+<li>Probably won&#8217;t be best for extremely long&#47;complex presentation slides</li>
</ul>
-<p>That's it! Hope you enjoy playing around with it.</p>
+
+<p>That&#8217;s it! Hope you enjoy playing around with it.</p>
<footer role="contentinfo">
<h2>Menu Navigation</h2>
<ul id="menu">