0
What does attribute "class" do
2 odpowiedzi
+ 1
The class attribute is a way for CSS and JavaScript to access multiple elements at once.
For example, with CSS:
The HTML:
<div class='bordered'>
...
</div>
<img class="bordered"...></img>
The CSS:
.bordered {
border: 1px black solid;
}
That will give both the div and the image a border.
The class attribute is also sometimes important to JavaScript.
var borderedElements = document.getElementsByClassName("bordered");
for each (elem in borderedElements) {
elem.remove();
}
That would remove all the elements with class="bordered" from the DOM.
0
Thnk you