W3.JS Ajouter un style au HTML
Ajoutez une valeur de propriété CSS :
w3.addStyle(selector,'property','value')
Ajouter un style par identifiant
Ajoutez une couleur de fond rouge à un élément avec id="London":
Exemple
<button onclick="w3.addStyle('#London','background-color','red')">Add Style</button>
Ajouter un style par balise
Ajoutez une couleur d'arrière-plan rouge à tous les éléments <h2> :
Exemple
<button onclick="w3.addStyle('h2','background-color','red')">Add Style</button>
Ajouter un style par classe
Ajoutez une couleur de fond rouge à tous les éléments avec class="city":
Exemple
<button onclick="w3.addStyle('.city','background-color','red')">Add Style</button>