HTML/CSS MCQ

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

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. The CSS property used to specify the transparency of an element is ________.

A opacity

B visibility

C filter

D None of these answers

A
The opacity property specifies the opacity/transparency of an element. The opacity property can take a value between 0.0 and 1.0. The lower the value, the more transparent the element. Example:

img {  opacity: 0.5;}

 

2. What is the correct syntax to link an external CSS file?

A <link rel="stylesheet" type="text/css" href="style.css">

B <link rel="stylesheet" type="text/css" src="style.css">

C <style rel="stylesheet" type="text/css" href="style.css">

D <style rel="stylesheet" type="text/css" src="style.css">

A
The correct way to reference an external CSS file is given in option A.
 

3. Which of the following methods are valid for representing a color in CSS?

A A valid color name

B RGB values

C HEX values

D All answers are correct

D
All of the above options are valid ways to represent a color in CSS. Example:

#p1 {background-color: blue;}            /* color name */
#p2 {background-color: rgb(255, 0, 0);}  /* RGB values */
#p3 {background-color: #0000ff;}         /* HEX values */
 
 

4. Which of the following methods selects all h1 headers inside a div element?

A div h1

B div.h1

C h1

D div-h1

A
To match child elements of a particular element, a single space is used. See an example.
 

5. Which CSS property is used to create rounded borders around elements?

A border-collapse

B border-round

C border-radius

D None of these answers

C
The border-radius property is used to create rounded borders around a given element. See an example.
 

6. How do you set the maximum width of a content box using CSS?

A The height property

B The max-height property

C The max-width property

D None of these answers

C
The max-width property in CSS is used to set the maximum width of a content box.
 
 

7. Which CSS property is used to specify different border styles?

A border-style

B border

C Both A and B

D None of these answers

A
The border-style property is used to specify different border styles in CSS. See an example.
 

8. Which of the following are valid values for the position property in CSS?

A fixed

B relative

C static

D All answers are correct

D
All of the above are valid CSS position values.
 

9. What is the purpose of the inherit value for a property?

A Inherits the value from the parent element.

B Invalid property name.

C Changes the value of the parent element’s property.

D None of these answers

A
The inherit property allows a property to inherit the value from the parent element. See an example.
 
 

10. Which of the following CSS properties is used to control layout?

A display

B color

C text

D None of these answers

A
The display property is the most important CSS property for controlling layout. See an 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 *