This content originally appeared on Ugly Duck and was authored by Bradley Taunt
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.
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…
This is what I came up with:
The Demo
See the Pen Presentation / Keynote Slides (Pure CSS) by Bradley Taunt (@bradleytaunt) on CodePen.
Yes, I know this is ugly, but this was created as a barebones skeleton for others to build upon. The demo uses a simple set of radio
inputs that correspond to their own individual slide
element. The “framework” looks at the currently checked
input, then changes the opacity
and z-index
of it’s corresponding slide item. Pretty straightforward stuff!
Let’s break down each piece:
The HTML
There isn’t a whole lot going on here. We are just including a set of radio
inputs (based on how many slides are desired) along with their corresponding slide
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!
The CSS (SCSS)
Again – not much to see here. We use CSS to look down through the DOM for each radio
elements slide “partner”. We do this by targeting the nth-of-type
on both elements. Simple stuff.
Some drawbacks to this approach:
- You need to manually target each new slide you add (color, styling, content, etc.)
- Lack of animations might require extra work to implement (maybe 3rd party libraries like AOS?)
- Probably won’t be best for extremely long/complex presentation slides
That’s it! Hope you enjoy playing around with it.
This content originally appeared on Ugly Duck and was authored by Bradley Taunt
Bradley Taunt | Sciencx (2020-06-22T13:47:48+00:00) Keynote Slides with Pure CSS. Retrieved from https://www.scien.cx/2020/06/22/keynote-slides-with-pure-css/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.