From 868cf5a5fdd5e5c471984cbbfe4b91c03d8d86eb Mon Sep 17 00:00:00 2001 From: Geronimo Hidalgo <45217034@terciariourquiza.edu.ar> Date: Thu, 21 May 2026 18:58:27 -0300 Subject: [PATCH] Cree una funcion para agregar una clase personalizada --- ejercicios-clase-8.js | 8 ++++++++ estilo.css | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index b238229..5dbc8c9 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -5,3 +5,11 @@ const changeText = (str) => { const h1 = document.querySelector("h1"); h1.textContent = str; } + +// Ejercicio 2 +const addClass = (className) => { + const itemLista = document.querySelectorAll("li"); + itemLista.forEach((item) => { + item.classList.add(className); + }); +} diff --git a/estilo.css b/estilo.css index fcb26fc..e55df68 100644 --- a/estilo.css +++ b/estilo.css @@ -101,6 +101,14 @@ h1 { font-weight: bold; } +/* Clase item-lista */ +.item-lista { + background: #fff4d6; + border-color: #f4b400; + color: #7a5200; + font-weight: bold; +} + /* ========================= IMAGEN ========================= */