HTML/CSS MCQ

HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 31

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 an interactive area in a document where the user can draw or interact graphically?

A <canvas>

B <graphics>

C <interactive>

D <svg>

A
The <canvas> tag is used to draw graphics or animations via JavaScript. It is used for creating games, dynamic graphics, data visualizations, etc.
 

2. How can you customize the appearance of bullets in an HTML list?

A By modifying the text with list-style-type

B By using the list-style-image property

C With list-item-design

D By using <custom-bullet>

B
To customize list bullets, you can use list-style-image in CSS, which allows you to replace bullets with an image. This makes the list visually unique.
 

3. Which HTML tag is used to associate an error message with a form field?

A <error>

B <message> with an id

C <span>

D <label> with a for

C
A <span> element with an id can be used to display a custom error message for a form field. This allows linking an error text to a specific field in the form.
 
 

4. How can you merge cells horizontally in an HTML table?

A With the colspan attribute

B By using rowspan

C With the merge attribute

D By manually adjusting the cell sizes

A
The colspan attribute allows you to merge multiple horizontal cells in an HTML table. It specifies how many columns the cell should span.
 

5. Which CSS property is used to underline the text of an element?

A text-decoration: underline;

B border-bottom: 1px solid;

C text-align: underline;

D line-height: underline;

A
The text-decoration: underline; property adds an underline to the text of the targeted element. It is commonly used to style links.
 

6. Which CSS property is used to change the direction of elements in a Flexbox container from horizontal to vertical?

A flex-direction: column;

B flex-direction: row-reverse;

C flex-wrap: reverse;

D justify-content: column;

A
The flex-direction: column; property changes the direction of elements in a Flexbox container from the default row (horizontal) to a column (vertical).
 
 

7. Which CSS pseudo-class is used to target the first letter of a text element?

A ::start

B ::first-letter

C ::first-character

D ::beginning

B
The ::first-letter pseudo-class targets and styles the first letter of a text element. It is often used to create typographical effects like stylized capital letters.
 

8. Which CSS property allows you to rotate an element in 3D space?

A transform: rotateX();

B transform: rotate3d();

C transform: rotateY();

D transform: perspective();

A
The transform: rotateX(); property rotates an element around the X-axis in 3D space. You can use other properties like rotateY() or rotateZ() for the Y and Z axes.
 

9. Which CSS property is used to define a custom variable in your stylesheet?

A --variable-name

B var()

C variable-name

D @variable

A
CSS variables start with — and can be used throughout your CSS to store reusable values. For example: --main-color: #f00;
 
 

10. Which HTML tag is used to create a hyperlink to an anchor located elsewhere on the same page?

A <link>

B <a href="#anchor">

C <button href="#anchor">

D <anchor>

B
The <a> tag with the href="#anchor" attribute creates a link to an anchor located elsewhere on the same page. The anchor is defined by an id attribute on the target element.
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *