Some characters look identical but can be stored in more than one Unicode sequence. Copying text from documents can also bring unusual spaces, quotation marks, or invisible characters.
What You Need to Know
A validator may report unexpected characters, or searches may fail to match two visually similar strings. Compare the actual characters before changing HTML tags.
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
Take a look at this small piece of HTML. You can use it in a practice document and change the text to make it your own.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<p>Use a real apostrophe: it's a great day.</p>
<p>Compare composed and decomposed text carefully.</p>
<code>café</code>
Let’s Understand the Example
- A p groups a paragraph of related text. Start another paragraph for a new thought.
- Code identifies a piece of computer code within prose.
Look for the text “Use a real apostrophe: it's a great day.” in the page. If the visible result surprises you, inspect the rendered elements to see what the browser actually built.
What Should You See?
The page should include “Use a real apostrophe: it's a great day.”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.
Try removing one piece of markup in a scratch copy, refresh the page, and compare the behavior. This is often the fastest way to understand what that piece contributes.
Try It Yourself
- Paste a phrase from a rich-text document into your editor and inspect its spaces and quotes.
- 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
- Assuming copied punctuation is always plain ASCII or that visually identical strings have identical code points.
- Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.
Key Takeaways
- Some characters look identical but can be stored in more than one Unicode sequence.
- A p groups a paragraph of related text. Start another paragraph for a new thought.
- A validator may report unexpected characters, or searches may fail to match two visually similar strings. Compare the actual characters before changing HTML tags.