HTML/CSS MCQ

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

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 changes the direction of items in a flex container?

A flex-direction

B align-items

C justify-content

D flex-wrap

A
The flex-direction property sets the direction of items in a flex container, such as row (horizontal) or column (vertical). See a complete example.
 

2. Which HTML tag is used to define a section of content?

A <section>

B <div>

C <article>

D <header>

A
The <section> tag is used to define a section of an HTML document that groups thematically related content. Example:

<section>
    <h2>My first section</h2>
    <p>This is a paragraph in the first section.</p>
</section>

<section>
    <h2>My second section</h2>
    <p>This is another paragraph in the second section.</p>
</section>
 

3. Which CSS pseudo-class targets an element when it is activated (e.g., a clicked button)?

A :hover

B :active

C :focus

D :visited

B
The :active pseudo-class targets an element at the moment it is activated, such as when a user clicks a button or link.
 
 

4. Which CSS property makes a flex item occupy all the available space in its container?

A flex-grow

B flex-shrink

C flex-basis

D flex

A
The flex-grow property allows a flex item to grow and fill all the available space in a flex container. See a complete example.
 

5. Which CSS property defines the order of items in a flex container?

A order

B flex-order

C flex-direction

D align-items

A
The ‘order’ property defines the order in which items appear in a flex container. See a complete example.
 

6. Which HTML tag is used to define an introductory section?

A <header>

B <article>

C <section>

D <nav>

A
The <header> tag is used to define the header of a page or section, typically containing introductory content or headings.
 
 

7. Which CSS property defines spacing between items in a flex container?

A margin

B gap

C padding

D align-items

B
The ‘gap’ property defines the spacing between items in a flex or grid container, making layout spacing easier to manage. See a complete example.
 

8. Which HTML attribute defines a password input field?

A type="text"

B type="password"

C type="secure"

D type="hidden"

B
The type="password" attribute in the <input> tag creates a field where characters are masked for privacy.
 

9. Which HTML tag is used to create a hyperlink to another page?

A <button>

B <link>

C <a>

D <url>

C
The <a> tag is used to create hyperlinks in HTML. The href attribute specifies the URL the link points to.
 
 

10. Which HTML tag is used to add a submit button in a form?

A <submit>

B <button>

C <input type="submit">

D <input type="button">

C
The <input type="submit"> tag is used to create a button that submits an HTML form.
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 *