0
0
HTMLmarkup~5 mins

Common HTML mistakes - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What happens if you forget to include the <!DOCTYPE html> declaration at the top of your HTML file?
The browser may enter quirks mode, causing inconsistent rendering and unexpected layout issues. Always include <!DOCTYPE html> to ensure standards mode.
Click to reveal answer
beginner
Why should you avoid using deprecated tags like <center> or <font> in HTML?
Deprecated tags are outdated and not supported in modern HTML. They reduce accessibility and make your code harder to maintain. Use CSS for styling and layout instead.
Click to reveal answer
intermediate
What is a common mistake when nesting HTML elements?
Placing block-level elements inside inline elements (like putting a <div> inside a <span>) is invalid and can break layout or cause unexpected behavior.
Click to reveal answer
beginner
Why is it important to always close your HTML tags properly?
Unclosed tags can cause browsers to guess the structure, leading to broken layouts and accessibility problems. Always close tags like <p>, <li>, and others.
Click to reveal answer
beginner
What mistake do developers often make with alt attributes on images?
Leaving the alt attribute empty or missing reduces accessibility for users with screen readers. Always provide meaningful alt text describing the image content.
Click to reveal answer
Which of the following is the correct way to start an HTML5 document?
A<!DOCTYPE html>
B<html5>
C<!DOCTYPE HTML5>
D<html lang="en">
What is wrong with this HTML snippet? <span><div>Content</div></span>
ANothing, this is valid HTML.
BThe <code>span</code> tag is deprecated.
CThe <code>div</code> tag must be self-closing.
DA <code>div</code> cannot be inside a <code>span</code> because <code>div</code> is block-level and <code>span</code> is inline.
Why should you avoid using inline styles like style="color:red;" directly in HTML?
AInline styles are faster to load.
BInline styles make the HTML file invalid.
CInline styles mix content with design, making maintenance harder.
DInline styles are required for accessibility.
What is the purpose of the alt attribute in an <img> tag?
ATo provide alternative text for screen readers and when the image fails to load.
BTo add a tooltip when hovering over the image.
CTo specify the image file path.
DTo style the image with CSS.
Which tag is used to create a clickable link in HTML?
A<link>
B<a>
C<href>
D<button>
List three common mistakes beginners make when writing HTML and explain why they cause problems.
Think about how browsers read HTML and how accessibility is affected.
You got /5 concepts.
    Explain why semantic HTML and accessibility attributes are important in web development.
    Consider users with disabilities and search engines.
    You got /4 concepts.