When selecting elements in CSS, normally we user ID or class to select them. We can use data attribute in an element to select an element as shown below.
HTML
<div data-somename>
Hi
</div>
CSS
[data-somename] {
color: red;
font-style: underline;
}
Cheers,
Samitha
HTML
<div data-somename>
Hi
</div>
CSS
[data-somename] {
color: red;
font-style: underline;
}
Cheers,
Samitha
No comments:
Post a Comment