Friday, 26 May 2017

javascript - DOM Manipulation and styling the background

I have a list that I want to give a metal/metallic background for each item in the list using DOM manipulation.


List using Bootstrap 4


 

  • Item 1

  • Item 2

  • Item 3

  • Item 4



This is my attempt to style the background of the class.


var backGroundMetallic = document.getElementsByClassName("list-group");
for(var i = 0; i < backGroundMetallic.length; i++) {
backGroundMetallic[i].style.backgroundColor = '#7fffd4';
}

I'm only able to put use one CSS color. Is there a way to reference a CSS class so I can use more than one style in order to style the background for the list to achieve making it metal/metallic?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...