// SETTING CSS PROPERTIES
// Variante 1/cssProperty of the style object
Element.style.cssProperty = propertyValue;
button.style.backgroundColor="lavender";
button.style.color="rebeccapurple";
// Variante 2/setProperty method of the style object
// damit können auch CSS custom properties gesetzt werden
Element.style.setProperty('property', 'value');
button.style.setProperty('background-color', 'lavender');
button.style.setProperty('color', 'rebeccapurple');
button.style.setProperty('--box-color', 'lavender');
// GETTING CSS PROPERTIES
// 1. getting inline styles
const myProperty = Element.style.property;
const fontSize = button.style.fontSize;
const color = button.style.color;
// 2. getting computed styles
const style = getComputedStyle(Element, pseudoElement);
const p = getComputedStyle(paragraph, '::before');
Element.setAttribute('name-of-attribute', 'value');
button.setAttribute('type', 'submit');
button.setAttribute('data-color', 'yellow');
// GETTING/READING ATTRIBUTES
Element.getAttribute('name-of-attribute');
Element.remove('name-of-attribute');
// GETTING and SETTING CUSTOM ATTRIBUTES
// with the dataset object property-value
console.log(Element.dataset);
Element.dataset.color = "limegreen";
// FINDING AN ELEMENTS SIZE AND POSITION
// getBoundingClientsRect method
Element.getBoundingClientRect();
// 1.1 el.querySelector, el.querySelectorAll
// searching for a specific room in the house is faster
// than searching from outside (document.querySelector)
// this property selects direct descendants (nested
// elements like li in ul) and returns an HTML collection
// please note the difference to firstChild!
// this property selects the parent element
// the parent element encloses the current element
// selects an element that can be multiple levels
// above the current element that matches a selector
const closestAncestor = Element.closest(selector);
// closest starts searching from the current element,
// which means that the current element can also be
// selected if the selector matches
// 3.1 nextElementSibling
// 3.2 previousElementSibling
// 3.3 Combining parentElement, children and index