Online admissions open for the SEO, PHP web development and networking & cybersecurity courses. Enquire for the next batch.

HTML and CSS Quiz: 12 Questions

Quiz · 12 questions Updated By the SkillNewton team

This free HTML and CSS quiz checks the core front-end skills you need before moving on to JavaScript or PHP: semantic elements, alt text, form labels, selector specificity, box-sizing, flexbox versus grid, CSS units, media queries, positioning and display. It is aimed at beginners and students revising for practicals or interviews. Answer all 12 questions, check your score, then read the explanations and revisit the CSS guide for anything you missed.

Choose one answer for each question, then check your score. Your answers stay in this browser and are not saved.

1. Which element should wrap a website's main navigation links?
2. An image is purely decorative. What should its alt attribute be?
3. What is the correct way to connect a label to a text input?
4. Which selector has the highest specificity?
5. With box-sizing: border-box; width: 200px; padding: 20px; border: 2px solid; how wide is the rendered box?
6. Which layout method is designed for two-dimensional layouts, controlling rows and columns together?
7. What is the rem unit relative to?
8. In a mobile-first stylesheet, which media query adds styles for screens 768px wide and wider?
9. An element has position: absolute. What is it positioned relative to?
10. You need an element that sits inline with text but accepts width, height and vertical padding. Which display value fits?
11. What is the difference between display: none and visibility: hidden?
12. Why is a button element better than a clickable div for an action?

Frequently asked questions

Do I need to know JavaScript for this quiz?

No. It covers only HTML and CSS. There is a separate JavaScript quiz when you are ready.

Why does the quiz include accessibility questions?

Alt text, labels and semantic elements are part of writing correct HTML. They help screen reader users and also help search engines understand the page.

Should I learn flexbox or grid first?

Most people start with flexbox for one-dimensional layouts such as navigation bars, then learn grid for full page and card layouts. You will use both.

Want to Learn This Properly?

The PHP Web Development: Foundation & Practical Implementation (Online) turns resources like this into practised skills, with projects on real websites.

WhatsApp Call Us Now

Free counselling

Send an Enquiry

Tell us which course you are interested in. We reply by email or phone with the next batch and how to enrol.

We reply by email or phone within working hours. No spam.