Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialtimur
Full Stack JavaScript Techdegree Graduate 18,104 PointsIs the second example trying the illustrate the same point as the first example?
I am confused about why the article shows how to use the CSS selector that select custom data attributes twice, what is the difference? Also, what is the advantage of using Data Attributes over using any other custom attributes?
1 Answer
Steven Parker
231,275 PointsI agree there wasn't much difference in the two examples, just a subtle variation in how the settings were being used in the CSS.
And the main advantage of data attributes is when using them with JavaScript, the browser makes them easy to access by adding a "dataset" object to the element with each one as a separate property. See the "Resources" link at the bottom for more details.
timur
Full Stack JavaScript Techdegree Graduate 18,104 Pointstimur
Full Stack JavaScript Techdegree Graduate 18,104 PointsThank you, Steven!