So i've append the child to the parent (h1) and parent has class cars
.
When i append the child, child gets the cars style too but i don't want this to happen.
Here's my style.css:
.items{
text-align: center;
font-size: 10;
}
.cars{
text-align: center;
font-size: 70;
}
Here's the javascript code i tried:
let cars = document.createElement("h1");
cars.textContent = cars.items;
cars.classList.add("cars");
let items = document.createElement("p");
items.textContent = items.name;
cars.appendChild(items);
items.classList.remove("cars");
items.classList.add("items");
I tried so many things (like using id of cars on css) but couldn't get it right.
under
(as h1 is category)
– Yousef GH Jan 21 '20 at 07:03