HTML/CSS MCQ

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

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 allows you to add a drop shadow around an element?

A shadow: 5px 5px 10px rgba(0,0,0,0.5);

B box-shadow: 5px 5px 10px rgba(0,0,0,0.5);

C text-shadow: 5px 5px 10px rgba(0,0,0,0.5);

D element-shadow: 5px 5px 10px rgba(0,0,0,0.5);

B
The box-shadow property allows you to add a drop shadow to an element. The parameters define the horizontal offset, vertical offset, shadow size, and color.
 

2. Which HTML tag allows you to place a video as the background of a page?

A <video> with position: absolute;

B <background-video>

C <media>

D <embed>

A
You can use the <video> tag to insert a video. To use it as a background, you can position it absolutely with position: absolute; and make it cover the entire screen.
 

3. How do you specify the main language of your HTML document?

A <html lang="fr">

B <html language="fr">

C <html lang="fr-FR">

D <document language="fr">

A
The <html> tag’s lang attribute specifies the main language of the document. For example, lang="fr" indicates that the document is in French.
 
 

4. How do you create a link to another web page in a new window or tab?

A <a href="page.html" target="_blank">

B <link href="page.html" target="_blank">

C <a href="page.html" new-window>

D <a href="page.html" open-window="true">

A
The target="_blank" attribute allows you to open a link in a new window or tab. This is very useful for external links.
 

5. Which CSS property allows you to define an infinite loop animation?

A animation-iteration-count: infinite;

B animation-loop: true;

C animation-restart: 0;

D infinite-loop: true;

A
The animation-iteration-count: infinite; property allows an animation to play an unlimited number of times. This is useful for continuous visual effects.
 

6. Which CSS function allows you to create a smooth transition effect between two states of an element?

A transition-speed

B transition-timing-function

C transition-duration

D transition-effect

B
The transition-timing-function property defines the speed curve of a transition. For example, you can use ease, linear, ease-in, or ease-out to control the transition speed.
 
 

7. Which HTML tag allows you to specify a different format for printing?

A <media>

B <print>

C <link rel="stylesheet" media="print">

D <style media="print">

C
The media="print" attribute in the <link> tag allows you to specify a separate CSS file for printing. This lets you customize the appearance of a page when printing (for example, by hiding elements or changing colors).
 

8. Which HTML tag is used to add content that can be modified by the user in a web page?

A <contenteditable>

B <editable>

C <textarea>

D <input type="text">

A
The contenteditable attribute allows you to make an HTML element editable by the user. This turns the element into a sort of editable text area in the browser.
 

9. Which CSS selector allows you to target the first child of a parent?

A :first-child

B :nth-child(1)

C :child(1)

D :first-of-type

A
The :first-child pseudo-selector allows you to select the first child of a parent element, regardless of type. For example, ul li:first-child will target the first <li> element in a <ul>.
 
 

10. Which CSS property allows you to animate the opacity of an element smoothly?

A opacity-transition

B transition: opacity 0.5s;

C opacity: animate;

D fade-in: true;

B
The transition: opacity 0.5s; property allows you to create a smooth animation to change the opacity of an element, for example, over a duration of 0.5 seconds. This creates fade-in or fade-out effects.
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 *