What is the purpose of a reference inside a div tag without attributes?
P粉197639753
P粉197639753 2024-03-20 11:26:40
0
1
367

I want to start using attribute selectors in my css. I see that the div tag contains references but does not have any attribute statements, for example:

<div class="container" data-footer>

All my searches (for the past hour) have turned up no information on how to list "data-footer" without using attribute= (e.g. id= or class= etc.). Dozens of SO and Google links without a single reference example inside a div tag without using attributes. Since I don't know what this is (or what to call it), I may not be using the correct keywords for my search. Is this a short way of passing the id or???

P粉197639753
P粉197639753

reply all(1)
P粉520545753

Data attributes without a value can be used as Boolean values. For example:

if(div.hasAttribute('data-footer')) {
   // then do something
}

In css you can access it like this:

div[data-footer] {

}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template