HTML/CSS MCQs

HTML5 semantic tags, CSS flexbox, grid layout, responsive design, and animations.

21 MCQsProgrammingAll Levels
Key Concept Overview & Exam Context

Review core principles of HTML/CSS before answering questions. These questions simulate placement technical assessments (TCS, Infosys, Amazon), university exams (CS/IT), and technical certifications.

Target Readiness
Placements & Job Interviews
Question Format
Multiple-Choice with Explanations
Verified Solutions
Step-by-step Output Traces

HTML/CSS MCQ Questions

Page 1 of 2 (21 total)
Q1

What is the CSS box model made up of?

easy
Correct Answer: Content, padding, border, and margin, arranged from innermost to outermost
Explanation:
Every HTML element is treated as a rectangular box, and the box model describes how the content sits inside padding, which is surrounded by a border, which is then surrounded by margin, spacing the element from its neighbors.
Q2

What does the CSS property 'display: flex' enable on a container element?

medium
Q3

What is the purpose of the HTML 'alt' attribute on an image tag?

medium
Q4

What is the difference between 'id' and 'class' attributes in HTML?

easy
Q5

What does CSS specificity determine?

hard
Q6

What is the purpose of a CSS media query?

medium
Q7

What is the difference between 'position: relative' and 'position: absolute' in CSS?

hard
Q8

What is the purpose of semantic HTML tags, such as <header> and <article>?

medium
Q9

What does the CSS 'z-index' property control?

medium
Q10

What is the purpose of CSS Grid layout?

hard
Q11

What does the HTML5 <section> tag represent?

medium
Q12

What is the purpose of the CSS 'float' property?

medium
Q13

What is the difference between an inline element and a block-level element in HTML?

easy
Q14

What does the CSS 'em' unit represent?

hard
Q15

What is the purpose of the HTML <meta name='viewport'> tag?

medium
Q16

What is the effect of setting 'box-sizing: border-box' on an element in CSS?

hard
Q17

What is the purpose of a CSS pseudo-class, such as ':hover'?

medium
Q18

What does the CSS 'transition' property allow you to do?

medium
Q19

What is the purpose of the <form> element in HTML?

easy
Q20

What does the CSS 'overflow: hidden' property do to an element?

medium
Showing 1 to 20 of 21 questions