What is the advantage of using CSS classes to show HTML elements compared to inline styles in JavaScript?
A). Inline styles provide better performance.
B). CSS classes allow for better separation of concerns and reusability.
C). Inline styles offer more flexibility in showing elements.
D). CSS classes increase code complexity and maintenance.
How can you show multiple HTML elements using JavaScript by adding a CSS class with visible properties?
A). element.style.visibility = 'visible';
B). element.classList.add('visible');
C). element.style.display = 'block';
D). element.classList.toggle('visible');
How can you show an HTML element using JavaScript without affecting its layout position?
A). element.style.display = 'visible';
B). element.style.visibility = 'visible';
C). element.style.position = 'absolute';
D). element.style.opacity = '1';
How can you show an HTML element using JavaScript without directly modifying its CSS properties?
A). Use the setAttribute() method to set display: block;.
B). Use the setStyle() method to set visibility: visible;.
C). Use the removeAttribute() method to remove the element from the DOM.
D). Use the toggle() method to toggle between visible and hidden states.
What happens to an HTML element when its visibility property is set to 'visible' using JavaScript?
A). It becomes invisible but still occupies space in the layout.
B). It becomes visible without affecting its layout position.
C). It is removed from the DOM.
D). It becomes hidden but still interacts with the layout.
How can you show an HTML element using JavaScript by modifying its inline style directly?
A). element.setAttribute('style', 'display: block;');
B). element.style.display = 'visible';
C). element.style.visibility = 'visible';
D). element.display = 'block';
How can you show an HTML element using JavaScript by setting its display property to 'block' in an external CSS file?
A). element.style.display = 'visible';
B). Link the HTML file to an external CSS file with a class that sets display: block;.
C). Import the external CSS file using JavaScript and apply it to the element.
D). element.display = 'block';
What is the advantage of using the classList property to show HTML elements compared to directly modifying CSS properties?
A). It allows for more granular control and better readability.
B). It provides better performance and faster execution.
C). It simplifies code structure and improves cross-browser compatibility.
D). It increases code complexity and maintenance.
What does setting the CSS visibility property to 'visible' do to an HTML element?
A). It makes the element transparent but still visible.
B). It hides the element without affecting its layout position.
C). It completely removes the element from the layout.
D). It becomes visible without affecting its layout position.
What is a common approach to showing a hidden HTML element by adding or removing CSS classes in JavaScript?
A). element.style.visibility = 'visible';
B). element.classList.toggle('hidden');
C). element.style.display = 'block';
D). element.classList.remove('hidden');