HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 22
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 CSS property allows you to center an element horizontally and vertically within a container using Flexbox?
A align-items: center; and justify-content: center;
B margin: auto;
C display: block;
D position: absolute; and top: 50%; left: 50%;
2. Which HTML tag is used to create a text area in a form?
A <input type="text">
B <textarea>
C <input type="textarea">
D <fieldarea>
3. What is the HTML entity for displaying a double quote ("
)?
A "
B >
C <
D &
4. What is the correct syntax to define a background color using a hexadecimal value?
A background-color: rgb(255, 0, 0);
B background-color: #ff0000;
C background-color: red;
D background-color: rgba(255, 0, 0, 1);
5. Where is the <meta>
tag typically placed in an HTML document?
A At the end of the document, before the </html>
tag
B Inside the <body>
section
C Inside the <head>
section
D Just before the <title>
tag
6. What HTML attribute is used to define the text displayed on a form’s submit button?
A text
B value
C label
D submit
7. Which CSS property is used to create a linear gradient?
A linear-gradient
B background-image
C gradient-color
D color-gradient
8. What is the correct syntax for embedding an image in an HTML page?
A <img src="image.jpg" alt="Image description">
B <image src="image.jpg">
C <img src="image.jpg">
D <image href="image.jpg">
9. Which CSS pseudo-class is used to style a link once it has been visited by the user?
A :focus
B :active
C :hover
D :visited
10. Which HTML tag is used to create a number input field in a form?
A <input type="number">
B <input type="text">
C <input type="range">
D <input type="date">