HTML/CSS MCQ

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

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. What is the role of media queries in CSS?

A They are used to create CSS animations.

B They allow applying CSS styles based on screen size or device.

C They are used to change background colors.

D They are used to create dropdown menus.

B
Media queries make a site responsive by applying different CSS styles based on screen size, resolution, or other device characteristics.
 

2. What is the hexadecimal value for the color red?

A #FF0000

B #FF0100

C #F00000

D #F00001

A
In hexadecimal, #FF0000 represents the color red (where FF equals 255 in decimal — the max value for the red component).
 

3. What is the hexadecimal value for the color blue?

A #FF0000

B #0000FF

C #F00000

D #F00001

B
In hexadecimal, #0000FF represents the color blue.
 
 

4. Which CSS property is used to create a linear gradient?

A gradient-background

B linear-gradient

C background-gradient

D color-gradient

B
The linear-gradient property is used to create a gradient background in an element. Example: background: linear-gradient(to right, red, yellow);. See a complete example.
 

5. Which HTML tag is used to embed a video file?

A <audio>

B <video>

C <embed>

D <source>

B
The <video> tag is used to embed videos in an HTML page. You can add attributes like controls to enable playback controls. See a complete example.
 

6. Which CSS property controls the display type of an element?

A position

B display

C visibility

D float

B
The display property defines how an element is displayed — such as block, inline, flex, grid, etc.
 
 

7. Which CSS property is used to change the font of text?

A font-family

B text-font

C font-style

D font-weight

A
The font-family property defines the font of the text. You can specify specific fonts or generic font families (like Arial, sans-serif).
 

8. Which CSS property is used to define a transition to animate style changes?

A animation

B transition

C move

D transform

B
The transition property creates transition effects by animating style changes between different states of an element. See a complete example.
 

9. Which HTML entity is used to display the infinity symbol (∞)?

A &infin;

B &infinite;

C &symbol;

D &inf;

A
The HTML entity &infin; is used to display the infinity symbol (∞) in a web page.
 
 

10. Which HTML tag is used to define a column header in a table?

A <td>

B <th>

C <tr>

D <thead>

B
The <th> tag is used to define a header cell for a column or row in a table. It is bold and centered by default. See a complete example.
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 *