I am trying to set separate background and border for each element in the array using JavaScript something like this. Until now what I have done outputis below. As I add a new element to the array, it will stretch the background.
let skills = [];
function displayname() {
console.log(document.getElementById("namehere").value);
x = document.getElementById("namehere").value;
skills.push(x);
console.log(skills)
document.getElementById("skill-set").innerHTML = skills
document.getElementById("skill-set").style.border = "1px solid blue";
document.getElementById("skill-set").style.backgroundColor = "yellow";
document.getElementById("skill-set").style.padding = "5px";
document.getElementById("skill-set").style.display = "inline-block";
document.getElementById('namehere').value = " ";
}
<label>Enter the skills: </label><br>
<input type=t ext id="namehere" onchange="displayname()">
<div id="skill-set"></div>