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 : 7101  
 
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

The easiest way to align items using flexbox

With the release of flexbox in CSS, it has become an essential tool when placing elements next to each other, since, by default, the children of a display: flexare stacked…

Dark Mode on website using CSS and JavaScript

In today’s article we are going to learn how to build pretty much standard these days on the web pages and that is the alternative color mode and switching between…

JavaScript: Spread and Rest operators

In today’s article we are going to talk about one of the features of the ES6 version(ECMAScript 2015) of JavaScript which is Spread operator as well as Rest operator. These features…

How To Add Filter Effects to Images with CSS

To achieve interesting effects on your images, learn about the 'filter' and 'Backdrop-Filter' properties of CSS. CSS filters are a very attractive feature of CSS that allows you to apply certain…

Javascript: what are callbacks and how to use them.

Today we are going to learn about a concept that is widely used in javascript and that is used quite a lot by today's frameworks, libraries, especially NodeJS. This is…

HTTP Cookies: how they work and how to use them

Today we are going to write about the way to store data in a browser, why websites use cookies and how they work in detail. Continue reading to find out how…

The package managers npm and yarn: main differences

Npm and yarn are package managers that help to manage a project’s dependencies. A dependency is, as it sounds, something that a project depends on, a piece of code that…

The Javascript asign() method to merge and clone objects

In this article, we will be covering Object.assign()method in javascript in detail with examples. A javascript object is a collection of key-value pairs. Keys are also known as properties of object. Keys…

All the javascript functions and methods to manipulate arrays

This article will show that the prominent JavaScript array functions are .map(), .filter(), and .reduce(), and will then go through examples of instances in which .every() and .some() would save…

TypeScript: The evolution of JavaScript

When you're involved in the development of a large project, programming languages like JavaScript don't seem to be the best solution. Their lack of elements such as Language Aids has…

Awesome JavaScript Games and Js Software to create Games

Best sites js13kGames 2019 - Highlights from the js13kGames 2019 competition. js13kGames 2018 - 13 Games in ≤ 13kB of JavaScript. js13kGames 2017 - Build a game in 13kB or less with js13kGames. Adventure Triangle:…

Is JavaScript good for machine learning?

One of the things you always hear when you are talking to someone related to the M.L. world is that, one must learn Python because the vast majority of the…

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