index.js 649 B

1234567891011121314151617
  1. // Task 6.1
  2. let body = document.body;
  3. let tags = ['div', 'ul', 'section', 'a', 'p'];
  4. let classes = ['list', 'item', 'gallery', 'holder', 'box'];
  5. let style = document.createElement ('style')
  6. document.head.appendChild ( style )
  7. style.innerText = `.list {color: red;}
  8. .item {list-style: none;}
  9. .gallery {background: #5363db;}
  10. .holder {cursor: pointer;}
  11. .box {color: #555;}`
  12. for(let i = 0; i < tags.length; i++) {
  13. let result = document.createElement(tags[i]);
  14. result.classList.add(classes[i]);
  15. result.innerText = `animals`
  16. document.body.appendChild(result)
  17. }