Comment assombrir une image de fond dans revealjs

RevealJs est un excellent framework html/css pour faire des présentations. Tu as plein de belles images mais qui sont trop lumineuses pour en faire des images de fond.

Voici comment procéder pour les assombrir :

<section data-background-image="guepard.png"
  data-background-opacity="0.3"
  data-background-size="cover"
  data-background-position="center" 
  data-background-repeat="no-repeat">

Le style particulier qui va faire le travail c’est : data-background-opacity. La valeur est comprise entre 0, très foncé, et 1 très clair.

Et voici les propriétés sur les images tirés de la documentation officielle :

Image Backgrounds

By default, background images are resized to cover the full page. Available options:

AttributDefaultDescription
data-background-imageURL of the image to show. GIFs restart when the slide opens.
data-background-sizecoverSee background-size on MDN.
data-background-positioncenterSee background-position on MDN.
data-background-repeatno-repeatSee background-repeat on MDN.
data-background-opacity1Opacité de l’image. 0 est transparent et 1 est totalement opaque.

Ancienne méthode :

<section
  data-background="linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.65)), url(img/bg.jpg)"
  data-background-size="cover"></section>

Vous aimerez aussi...

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

fr_FRFrench