HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 25
Multiple choice questions and answers (MCQs) on HTML/CSS to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as tags, web standards, CSS selector, objects, and more. This quiz will easily prepare anyone to pass their online test.
1. Which HTML tag is used to define a navigation bar?
A <nav>
B <menu>
C <footer>
D <header>
2. How do you apply a CSS style to all <p>
elements in an HTML file?
A p { color: blue; }
B p[style] { color: blue; }
C all p { color: blue; }
D p > { color: blue; }
3. What is the effect of the CSS property display: none;
?
A The element becomes invisible but still occupies space on the page
B The element is completely hidden and occupies no space
C The element becomes invisible but remains interactive
D The element becomes opaque
4. Which HTML attribute is used to add a caption to a table?
A <legend>
B <caption>
C <title>
D <header>
5. Which CSS property is used to set the height of an element?
A width
B height
C size
D box-height
6. What is the effect of the CSS float
property?
A It sets the element’s position relative to its parent.
B It allows an element to float left or right inside its container, letting content flow around it.
C It removes the element from the normal document flow.
D It adjusts the element’s width.
7. Which CSS property adjusts the spacing between words?
A letter-spacing
B word-spacing
C line-height
D text-spacing
8. Which CSS property defines how floating elements behave around other content?
A clear
B float
C position
D display
9. Which CSS property allows an element’s size to adjust based on its content?
A height
B min-height
C max-height
D auto
10. Which CSS property displays an element as a block, taking up the full available width?
A display: block
B display: inline
C display: inline-block
D display: none