From the course: CSS Shorts

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Add content from attribute values

Add content from attribute values - CSS Tutorial

From the course: CSS Shorts

Add content from attribute values

- [Instructor] Hi, this is Chris Converse, and in this episode we'll use a pseudo element to add content to our webpage. And the content will come from the value of an HTML element attribute. So if you'd like to follow along with me download the exercise files, and let's begin by opening the HTML file in a text editor. And once you have the HTML file open you'll see up in the head area we have a link to style.css. We'll be opening this in a moment, and inside of the body area I have an article element, and then I have an anchor link that links to a series of different videos. Now each video link has an image inside, and some text. And now there's another piece of information on each one of these video links in the anchor tag, and that is a data attribute. So you'll see here data-topic equals transform. Sometimes web developers will use attributes like this in order to store extra data in the HTML file. This way they can use JavaScript to create things like filtering tools allowing for…

Contents