Some attribute values hold several words separated by spaces, such as class="card featured wide". Each word is its own token, not one long class name.
What You Need to Know
Tokens should have the meanings and uniqueness rules required by their attribute. Adding duplicate class tokens does not create extra styling effects.
A space-separated token list, like class or rel, contains individual words. In CSS, the order of classes normally does not establish which style wins.
The goal is not to collect as many tags as possible. Pick the element that best describes what the content really is.
Example: See It in Action
Here is a simple example to experiment with. Type it, save the file, and check what the browser displays.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<div class="card featured wide">
<h2>Featured story</h2>
<p>Each class name is one token.</p>
</div>
Let’s Understand the Example
- Div groups content but has no special meaning of its own; prefer a meaningful element when one fits.
- An h2 starts a major section beneath the page topic.
- A p groups a paragraph of related text. Start another paragraph for a new thought.
- Class is a reusable label for styling or scripts; several elements may share the same class.
You should see a readable heading and its related content. The heading level tells readers how the ideas fit together, not merely how large the letters look.
What Should You See?
The page should display “Featured story” as a heading, followed by its related content. Change the heading text and refresh the browser to see the result.
Read only the headings, from top to bottom. Do they tell a sensible story? If not, move sections or choose levels that match the content.
Try It Yourself
- Remove one class from the card, then add another short class name without commas.
- Save your changes, open or refresh the page, and compare the result with the original example.
- Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.
Common Beginner Mistakes
- Putting commas between class names or confusing class tokens with a whole sentence.
- Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.
Key Takeaways
- Some attribute values hold several words separated by spaces, such as class="card featured wide".
- Div groups content but has no special meaning of its own; prefer a meaningful element when one fits.
- A space-separated token list, like class or rel, contains individual words. In CSS, the order of classes normally does not establish which style wins.