HTML/CSS MCQ

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

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 type of HTML input is used to enter a password?

A <input type="password">

B <input type="text">

C <input type="email">

D <input type="hidden">

A
The <input type="password"> element is used to create a text field where the text is hidden, ideal for passwords.
 

2. Which HTML property is used to make a form field required?

A checked

B mandatory

C valid

D required

D
The ‘required’ attribute is used in form elements (like <input>, <textarea>, etc.) to indicate that the field must be filled out before the form is submitted. Example:

<input type="text" id="name" name="name" required>
 

3. Which HTML tag is used to create a dropdown menu for selection?

A <select>

B <input>

C <dropdown>

D <option>

A
The <select> tag is used to create a dropdown menu, and each option in the menu is defined using the <option> tag.
 
 

4. Which CSS selector is used to target all the elements of a page?

A *

B all

C every

D body

A
The universal selector * targets all elements on the page. For example, * { color: red; } applies the color red to all elements on the page.
 

5. Which HTML tag is used to create a radio button in a form?

A <input type="radio">

B <button type="radio">

C <input type="checkbox">

D <radio>

A
The <input type="radio"> tag is used to create a radio button, allowing the user to select one option from a group of choices.
 

6. Which CSS property allows positioning an element relative to its parent element with position: relative;?

A position: fixed;

B position: absolute;

C position: relative;

D position: sticky;

B
The position: absolute; property is used to position an element relative to its nearest positioned parent (with position: relative;).
 
 

7. Which HTML entity is used to display the character ” < "?

A &lt;

B &gt;

C &copy;

D &amp;

A
The entity &lt; is used to display the character ” < " in HTML code, as this character has a special meaning (it marks the beginning of a tag).
 

8. How do you target all elements with the class “box” in CSS?

A class="box"

B #box

C box

D .box

D
The CSS selector .box is used to target all elements with the class “box.” In CSS, a dot (.) before a name refers to a class.
 

9. Which HTML tag is used to enter a date in a form?

A <input type="date">

B <input type="datetime">

C <input type="time">

D <input type="calendar">

A
The <input type="date"> element allows you to create a date input field in a form, displaying a native calendar in modern browsers. Example:
 
 

10. Which Flexbox property aligns elements at the bottom of the container?

A justify-content: flex-end;

B align-items: flex-end;

C align-self: flex-end;

D justify-items: flex-end;

B
The property align-items: flex-end; is used to align elements at the bottom of a Flexbox container. 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 *