
The process of conceiving and constructing a presentation is often hard.
Sometimes we're stuck with Keynote or PowerPoint, and the templates are extremely limited and generic.
Today, we're going to learn how to create an awesome and animated presentation using HTML, CSS, and JavaScript.
If you're a beginner, don't worry! This tutorial will be easy enough to keep up with.
For this progect, we're going to use a framework called Reveal.js.
It provides robust functionality for creating interesting and customizable presentations.
- Go to the Reveal.js repository and clone the project
- Change directories into your newly cloned folder and run npm install to download the package dependencies. Then run npm start to run the project.
Built-In Themes
Reveal includes 11 themes. At this point, you will surely want to know how to change a theme
- Open index.html
- Change the CSS import to reflect the theme you want to use
The theme files are:
- beige.css
- black.css
- blood.css
- league.css
- moon.css
- night.css
- serif.css
- simple.css
- sky.css
- solarized.css
- white.css
Let's create a custom theme.
- Open css/theme/src inside your IDE. This holds all of the Sass files (.scss) for each theme. You can use a JavaScript task runner like Grunt (the files will be transpiled to CSS) or you can just create the CSS file inside css/theme.
- If you decide to use a JavaScript task runner, now you have to create a new .scss file. You can call the file custom.scss. You may have to stop your localhost and run npm run build to transpile your Sass code to CSS.
- Inside the index.html file, change the CSS theme import in the <head>tag to use the name of the newly created stylesheet.
- Now you can created variables for all of the different styles you want to use.
IMPORTANT: If you decide to use a JavaScript task runne add a .reveal class to the custom Sass file.
Mixins & Settings
Reveal.js also allows mixins and settings you can leverage in your custom theme.
To use them, just import the files:
@import "../template/mixins"; @import "../template/settings";
Playing with elements
The structure for adding new content is:
.reveal > .slides > section
The <section>
element represents one slide. Add as many sections as you need for your content.
How to make vertical slides
To create vertical slides, simply nest sections.
How to add Transitions
There are 6 different slide transitions to choose from:
- None
- Fade
- Slide
- Convex
- Concave
- Zoom
To use them, add a data-transition="{name}"
to the <section>
which contains your slide data.
How to add Fragments
Fragments are great for highlighting specific pieces of information on your slide. Here is an example.
To use fragments, add a class="fragment {type-of-fragment}"
to your element.
The types of fragments can be:
- grow
- shrink
- fade-out
- fade-up
- fade-in-then-out
- fade-in-then-semi-out
- highlight-current-blue
- highlight-red
- highlight-green
- highlight-blue
You can additionally add indices to your elements to indicate in which order they should be highlighted or displayed by using the data-fragment-index={index} attribute.
Enjoy!
Image by StartupStockPhotos from Pixabay
Janeth Kent
Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN END DEVELOPMENT.
Related Posts
How to make your own custom cursor for your website
When I started browsing different and original websites to learn from them, one of the first things that caught my attention was that some of them had their own cursors,…
Node.js and npm: introductory tutorial
In this tutorial we will see how to install and use both Node.js and the npm package manager. In addition, we will also create a small sample application. If you…
How to connect to MySQL with Node.js
Let's see how you can connect to a MySQL database using Node.js, the popular JavaScript runtime environment. Before we start, it is important to note that you must have Node.js installed…
JavaScript Programming Styles: Best Practices
When programming with JavaScript there are certain conventions that you should apply, especially when working in a team environment. In fact, it is common to have meetings to discuss standards…
Difference between arrow and normal functions in JavaScript
In this tutorial we are going to see how arrow functions differ from normal JavaScript functions. We will also see when you should use one and when you should use…
JavaScript Arrow functions: What they are and how to use them
In this article we are going to see what they are and how to use JavaScript Arrow Functions, a new feature introduced with the ES6 standard (ECMAScript 6). What are Arrow…
How to insert an element into an array with JavaScript
In this brief tutorial you will learn how to insert one or more elements into an array with JavaScript. For this we will use the splice function. The splice function will not…
What is the difference between primitives types and objects in JavaScript?
In this short tutorial we are going to look at the differences between primitive types and objects in JavaScript. To start with, we're going to look at what primitive types…
How to get DOM elements with JavaScript
When you access any element of the DOM, it is usual to save it in a variable. This is something that at first might seem very simple, but if you…
How to reverse an array in JavaScript
In this tutorial we are going to see how you can change the order of the elements of an array so that they are inverted. You could use a loop…
How synchronize the scroll of two divs with JavaScript
In case you have two divs of different sizes you may sometimes want to scroll both at the same time but at different speeds depending on their size. For example,…
Nesting: future proofing CSS
Although not currently supported by browsers, there is a proposal for CSS nesting to support a feature that would provide better readability to native CSS, so in the future it…