HTML/CSS MCQ

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

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 create a reset button in a form?

A <button type="reset">

B <input type="reset">

C <button reset>

D <input reset>

B
The <input type="reset"> tag creates a button that resets all form fields to their default values.
 

2. If a parent element has an opacity of 0.5, what effect will it have on its child elements?

A The opacity of the children remains unchanged.

B The children will also appear transparent with 0.5 opacity.

C The children will be completely opaque.

D The children will become invisible.

B
Opacity is inherited in CSS, so if the parent has an opacity of 0.5, all child elements will appear equally transparent. See a complete example.
 

3. Which attribute is used to link an external CSS file in an HTML document?

A link

B href

C style

D css

A
The <link> element is used to link an external CSS file to an HTML document. It is placed inside the <head> section.
 
 

4. What does the CSS property position: relative; do?

A Positions the element relative to its parent.

B Positions the element relative to the screen.

C Allows moving an element from its normal position based on offset values.

D Positions the element based on the page content.

C
With position: relative;, an element is positioned relative to its original spot, enabling you to move it without affecting other elements.
 

5. Which CSS property is used to apply an animation to an element?

A animate

B animation-name

C motion

D transition

B
The animation-name property specifies the name of the animation to apply to an element. This animation is defined using the @keyframes rule. See a complete example.
 

6. Which CSS selector targets all <p> elements inside a <div>?

A div p

B div + p

C div > p

D p div

A
The selector div p selects all <p> elements that are descendants of a <div>. Example:

<div><p>This paragraph is inside a div.</p></div>
<div><p>Another paragraph inside another div.</p></div>
 
 

7. Which HTML attribute is used to submit a form?

A action

B method

C submit

D send

C
The submit attribute is used to send a form, typically used in the form of a button inside the form.
 

8. Which HTML tag is used to group the header of a table?

A <thead>

B <tbody>

C <tfoot>

D <tr>

A
The <thead> tag is used to group the header rows of an HTML table. See a complete example.
 

9. Which CSS property sets a delay before an animation starts?

A animation-duration

B animation-delay

C transition-duration

D animation-timing

B
The animation-delay property specifies a delay before the animation begins.
 
 

10. Which CSS selector targets an element that is the first child of its parent?

A parent:first-child

B element:first-child

C first-child

D parent > first-child

B
The element:first-child selector targets the first child of a specific parent. 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 *