From the course: Practical CSS for No-Coders
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Writing a class selector
From the course: Practical CSS for No-Coders
Writing a class selector
- [Instructor] Currently in our work, all of the paragraphs are blue. But what happens if I want to make just one paragraph green? Or what happens if I want to make part of one paragraph green? How might we go about doing that? Fortunately, we can add classes to our HTML to provide a hook that we can style. Class is an HTML attribute that may be added to any HTML element. Remember that an HTML attribute is anything that describes that HTML element in a bit more detail. So we're going to start here with our HTML. And let's say that we want this first paragraph here to be green. To the HTML, we are going to add a class attribute, right inside of that paragraph tag just after the p and we'll say equals, and then inside of quotes, we can give this any name that we want. Now we could call this George if we wanted, but George does not imply a green text color or even that this is the introduction to the page. So we may want…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.