How To Build A Presentation Using HTML, CSS, & JavaScript

by Janeth Kent Date: 13-10-2020 javascript html5 css sass presentations


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.

  1. Go to the Reveal.js repository and clone the project
  2. 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

  1. Open index.html
  2. 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.

  1. 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.
  2. 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.
  3. Inside the index.html file, change the CSS theme import in the <head>tag to use the name of the newly created stylesheet.
  4. 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
 
by Janeth Kent Date: 13-10-2020 javascript html5 css sass presentations hits : 8852  
 
Janeth Kent

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

What are React Hooks and what problems they solve

Working with React, - and before the release of Hooks in version 16.8 -  there was always the possibility to create components in three different ways based on a number of…

Flattening arrays in JavaScript

When we are handling arrays that are arrays or have multiple dimensions it can be very useful to know how to flatten arrays in JavaScript. That is to say, to…

How to populate an array with random numbers in JavaScript

Some of you might think that what we explained in the article on how to populate an array with numbers, apart from the didactic part, would not have much applicability…

How to populate an array with numbers in JavaScript

Populate an array with numbers in JavaScript The first step is to initialise the array. So today we are going to see a simple way to do it and see how…

Top Javascript Libraries and Frameworks Part 2

What are JavaScript frameworks?   JavaScript frameworks are application frameworks that allow developers to manipulate code to meet their particular needs. Web application development is like building a house. You have the option…

How to Send Email from an HTML Contact Form

In today’s article we will write about how to make a working form that upon hitting that submit button will be functional and send the email (to you as a…

Top JavaScript libraries and frameworks part 1

JavaScript libraries and frameworks make it easy to develop websites and applications with a wide variety of features and functionality, all with dynamic, flexible and engaging features. According to a 2020…

Looping through a matrix with JavaScript

We were already talking about how to multiply arrays in JavaScript and we realised that we had not explained something as simple as traversing an array with Javascript. So we…

Use the SRCSET attribute to improve your SEO

There is a new standard HTML attribute that can be used in conjunction with IMG called SRCSET. It is new and important as it allows webmasters to display different images…

How to multiply matrices in JavaScript

It may seem strange to want to know how to multiply matrices in JavaScript. But we will see some examples where it is useful to know how to perform this…

JavaScript Formatting Date Tips

Something that seems simple as the treatment of dates can become complex if we don't take into account how to treat them when presenting them to the user. That is…

How to make a multilingual website without redirect

Today, we're going to talk about how to implement a simple language selector on the basic static website, without the need of any backend or database calls or redirection to…

We use our own and third-party cookies to improve our services, compile statistical information and analyze your browsing habits. This allows us to personalize the content we offer and to show you advertisements related to your preferences. By clicking "Accept all" you agree to the storage of cookies on your device to improve website navigation, analyse traffic and assist our marketing activities. You can also select "System Cookies Only" to accept only the cookies required for the website to function, or you can select the cookies you wish to activate by clicking on "settings".

Accept All Only sistem cookies Configuration