top of page
Writer's pictureRajesh Singh

CSS MCQ Questions with Answer

Updated: Dec 30, 2024

CSS MCQ



Q 1. What is CSS?

a. CSS is a style sheet language

b. CSS stands for Cascading style sheet.

c. CSS is used to style the HTML documents

d. All of the mentioned

Answer: d

Q2.Which CSS property used to control the element’s font-size is

a. font-size

b. text-size

c. text-style

d. None

Answer: a

Q.3 Which CSS selector is used for unique element?

a. Id

b. text

c. class

d. name

Answer: a

Q. 4What is the correct syntax for referring an external CSS?

a. <link rel="stylesheet" type="text/css" href="mycss.css">

b. <stylesheet rel="stylesheet" type="text/css" href="mycss.css">

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

d. All of the above

Answer: a

Q. 5 Where is the correct place for external css in HTML document?

a. In <head> section

b. At the end of the document

c. In the <body> section

d. At the top of the document

Answer: a

Q. 6 There is a CSS rule for paragraphs tags in a CSS file, p can be called?

a. Selector

b. Attribute

c. Property

d. Tag

Answer: a

Q. 7 Internal styles are written within below code.

a. <style>…</style>

b. <css>…</css>

c. <stylesheet>…</stylesheet>

d. Both a and b

Answer: a

Q. 8 which tag used for internal CSS?

a. <css>

b. <script>

c. <style>

d. None

Answer: c

Q.9 which text property defines the minimum and maximum between words in CSS?

a. word-wrap

b. word spacing

c. word-break

d. white-space

Answer: b

Q.10 we want to change in entire website by changing one file css, which type css used for it?

a. Inline CSS

b. Internal CSS

c. External CSS

d. Both Inline and Internal CSS

Answer: c

Q. 11 which property is used to change the background color of an element in CSS?


a. bgcolor

b. color

c. background-color

d. None of Above

Answer: c

Q. 12 Which CSS property will be used for don't want to allow a floating div to the left side of an element?

a. margin

b. clear

c. float

d. padding

Answer: b

Q. 13 which syntax is correct to display the hyperlinks without any underline?

a. a {decoration : no-underline;}

b. a {text-decoration : underline;}

c. a {text-decoration : none;}

d. None

Answer: c

Q.14 which is the correct syntax to make the background-color of all paragraph elements to yellow?

a. all {background-color : yellow;}

b. p {background-color : #yellow;}

c. p {background-color : yellow;}

d. all p {background-color : #yellow;}

Answer: c



Q.15 which property is used as the shorthand property for the padding properties?

a. padding-right

b. padding-left

c. padding

d. None of the above

Answer: c

Q.16 which has introduced text, list, box, margin, border, color, and background properties?

a. HTML

b. PHP

c. CSS

d. Ajax

Answer: a

Q. 17 which is used to create a responsive design?

a. javascript

b. rails

c. ajax

d. bootstrap

Answer: d

Q. 18 which is used to specify a rule to bind a particular unique element in CSS selector?

a. tag

b. id

c. class

d. both class and tag

Answer: b

Q. 19 which is the correct CSS syntax in HTML?

a. body{color:black}

b. {body;color:black}

c. {body:color=black(body)}

d. body:color=black

Answer: a

Q. 20 which is the CSS comments

a. //

b. /* and */

c. <* and *>

d. // //

Answer: b.

21. Which property is used to define the font of the element's text in CSS?


a. font

b. font-family

c. font-style

d. None of the above

Answer: b

Q. 22 How to add a background color for all <h2> elements?

a. all.h2{backgorund-color:#FFFFFF

b. h2.all{backgorund-color:#FFFFFF

c. h2{backgorund-color:#FFFFFF

d. None of Above

Answer: c



Q. 23 which CSS property is used for text italic?

a. font

b. font-family

c. font-style

d. None of the above

Answer: c

Q. 24 which attribute is used for text bold

a. font-weight : bold

b. weight: bold

c. font: bold

d. style: bold

Answer: a

Q.25 Negative values are allowed in padding property.

a. Yes

b. No

c. Can't say

d. May be

Answer: b

Q. 26 which css property is used for wrap a block of text around an image

a. wrap

b. push

c. float

d. align

Answer: c

Q. 27 How to select the elements with the class name “careerbodh”?

a. career

c. careerbodh

d. .careerbodh

Answer: d

Q. 28 which syntax is correct in CSS to make each word of a sentence start with a capital letter?

a. transform : capitalize;

b. text-style : capital;

c. text-transform : capital;

d. text-transform : capitalize;

Answer: d

Q. 29 which are the valid values of font-style property?

a. italic, bold, bolder

b. normal, bold, italic

c. underline, bold, italic

d. inherit, italic, normal, oblique

Answer: d



Q.30 which is CSS property is used to specify the transparency of an element?

a. opacity

b. filter

c. visibility

d. overlay

Answer: a

Q. 31 which is the correct syntax of border property in CSS?

a. border: border-width border-style border-color

b. border: border-color border-width border-style

c. border: border-style border-width border-color

d. None of the above

Answer: a

Q. 32 Which CSS property is used to change color from Mouse over?

a. a:mouseover

b. a:move

c. a:mover

d. a:hover

Answer: d

Q.33 How to change the left margin of an element?

a. margin

b. indent

c. margin-left:

d. text-indent:

Answer: c

Q.34 Which CSS property is used to specify the space between every letter inside an element?

a. alpha-spacing

b. character-spacing

c. letter-spacing

d. alphabet-spacing

Answer: c

Q. 35 which attribute is used a dotted border around an image?

a. border-color

b. border-decoration

c. border-style

d. border-line

Answer: c

Q.36 Which CSS property is used to specify whether the text is written in the horizontal or vertical direction?

a. text-indent

b. writing-mode

c. word-break

d. None

Answer:b


Q. 37 which are the valid values of text-align property?

a. left, middle, right

b. left, center, right

c. left, center, right, justify

d. left, middle, right, justify

Answer: c

Q. 38 The correct syntax to select all paragraph elements in a div element is ….

a. div p

b. p

c. div#p

d. div ~ p

Answer: a

Q.39 Which CSS property is used to draw a line around the elements outside the border?

a. line

b. border

c. padding

d. outline

Answer: d

Q.40 Which CSS property is used to specify table borders in CSS?

a. table:border

b. table

c. border

d. none of the mentioned

Answer: c

Q.41 Which is the correct syntax to select the p siblings of a div element?

a. p

b. div p

c. div + p

d. div ~ p

Answer: d

Q.42 Which CSS property is used to add some margin between a DIV's border and its inner text?

a. spacing

b. margin

c. padding

d. inner-margin

Answer: c

Q. 43 The default value of position attribute is

a. fixed

b. absolute

c. inherit

d. relative

Answer: d

Q. 44 Which CSS property is used to add shadows to the text?

a. text-shadow

b. text-stroke

c. text-overflow

d. text-decoration

Answer: a

Q. 45 Which CSS property is used to specify the indentation of the first line of a text?

a. text-align-left

b. padding-left

c. margin-left

d. text-indent

Answer: d

Q.46 Which is not a value of the font-variant property in CSS?

a. normal

b. small-caps

c. large-caps

d. inherit

Answer: c

Q.47 Which CSS property is used to specify whether the table cells share the separate border?

a. border-collapse

b. border-radius

c. border-spacing

d. All of the above

Answer: a

Q. 48 Which selector in CSS is used to select the elements that do not match the selectors?

a. :! selector

b. :not selector

c. :empty selector

d. All of the above

Answer: b



Q. 49 Which is not a type of combinator?

a. >

b. ~

c. +

d. *

Answer: d

Q. 50 Which CSS property defines how an image or video fits into container with established height and width?

a. object-fit

b. object-position

c. position

d. All of the above

Answer: a

Q. 51The correct CSS statement is used to remove the markers/bullets?

a. list-style: none;

b. list-style-type: 0;

c. list-style-type: blank;

d. list-style-type: none;

Answer: d

Q.52 Which type of CSS in the below code?

<p style = "border:2px solid red;">

a. Inline CSS

b. Internal CSS

c. External CSS

d. All of the above

Answer: a

Q. 53 Which CSS function performs a calculation to be used as the property value?

a. sum()

b. add()

c. calc()

d. addition()

Answer: c

Q. 54 In below code, identify the selector

p {border: 2px solid blue;}

a. p

b. border

c. 2px

d. None of these

Answer: a

Q. 55 How many color supports in CSS?

a. 140

b. 100

c. 75

d. 90

Answer: a

Q.56 Which selector is used to selects all the <h> elements where the parent is a <div> element.

a. h + p

b. h > p

c. p.h

d. p > h

Answer: b

Q. 57 Which CSS property is used to specify the type of quotation mark?


a. quotes property

b. z-index property

c. hyphens property

d. All of the above

Answer: a

Q. 58 Below code represents a universal selector?

a. *{border: 2px solid red;}

b. body {border: 2px solid red;}

c. both A&B

d. None of Above

Answer: a



Q. 59 Below code represent

p {display: flex;}

a. All the <p> elements are displayed as a block-level flex container

b. All the <p> elements are not displayed by the browser

c. All the <p> elements are displayed as a grid container

d. All the <p> elements are displayed as an inline flex container

Answer: a.

Q. 60 Which CSS3 property can be used to allow line breaks within words?

a. line-breaks

b. lines-wrap

c. words-break

d. word-break

Answer: d

O Level July 2022 asked questions asked by NIELIT SET 1:

Q61.  In CSS the difference between two lines of your content is set by :

(A) min-height property

(B) line-height property

(C) max-height property

(D) none of these

Ans: B

Q62. Following HTML tag is used to declare internal CSS :

(A) <style>

(B) <Head>

(C) <link>

(D) <Script>

Ans: A

Q63. Function that allow calculation in CSS :

(A) calc() function

(B) calculator()

(C) calculate()

(D) calcu()

Ans: A

Q64. The attribute used to change the background color of an element in CSS :

(A) bgcolor

(B) color-bg

(C) bg-color

(D) background - color

Ans: D

Q64. Function to insert values of a CSS variable is :

(A) var()

(B) rand()

(C) varchar()

(D) calc()

Ans: A

Q65. A type of combinator in CSS is :

(A) >

(B) +

(C) ~

(D) All of the above

Ans: D

Q66. HSL in CSS stands for ?

(A) hue, standard, lightning

(B) height, standard, line-break

(C) hue, saturation, lightness

(D) hue, standard, line-width

Ans: C

Q67. The type of CSS popularly used for designing pages for websites :

(A) Inline

(B) External

(C) Internal

(D) None of the above

Ans: B

Q68. How to change the text sizes in CSS ?

(A) font-family

(B) font-size

(C) font

(D) Both (A) and (C)

Ans: B

Q69. Which of the following is the correct CSS syntax ?

(A) <h1 "color:Tomato;">...</h1>;

(B) <h1 style:"color=Tomato;">...</h1>;

(C) <h1 style="color:Tomato;">...</h1>;

(D) <h1 “color=Tomato;">...</h1>;

Ans: C

Q70. Which of the following is used to specify the transparency of an element is in CSS :

(A) opacity

(B) filter

(C) visibility

(D) vague

Ans: A

Q71.The correct syntax for referring to an external CSS ?

(A) <link rel=”stylesheet” type=”text/css” href=”style.css>

(B) <style rel=”stylesheet” type=”text/css” href=”style.css>

(C) Both (A) and (B)

(D) neither (A) nor (B)

Ans: A

Q72. How to add shadow to text in CSS ?

(A) Content Shadow

(B) Text Shadow

(C) Word Shadow

(D) Text outline

Ans: B

Q73. In CSS which of the following are different types of gradients :

(A) Linear

(B) conic

(C) Radial

(D) All of the above

Ans: D

Q74. The attribute used to make rounded corners around an element in CSS is :

(A) border-radius

(B) border-round

(C) border-spacing

(D) none of the above

Ans: A

Q75. Different ways in which CSS one can be added to the HTML :

(A) Inline

(B) Internal

(C) External

(D) All of the above

Ans: D

Q76. Symbol used to write comment in CSS is :

(A) /**/

(B) //

(C) ##

(D) #

Ans: A

Q77. CSS's position property default value is __________.

(A) Relative

(B) Absolute

(C) Fixed

(D) Static

Ans: D

O Level July 2022 asked questions asked by NIELIT SET 2:

Q78. Which of the following is a correct CSS Syntax ?

(A) {body; color:orange;}

(B) {body: color=orange;}

(C) body:color=orange;

(D) body{color:orange;}

Ans: D


Q79. Which CSS property should one use to encircle an image with text?

(A) Float

(B) Push

(C) Align

(D) wrap

Ans: A

Q80. Which type of CSS is used in the code below ?

<p style = "border:2px solid red;">

(A) External CSS

(B) Internal CSS

(C) Inline CSS

(D) None of these

Ans: C

Q81. For what purpose is the CSS padding property used ?

(A) Border

(B) Space

(C) Background Color

(D) Margin

Ans: B

Q82. Which of the following is not possible to animate using CSS?

(A) Padding

(B) Word-spacing

(C) Text-transform

(D) Width

Ans: C

Q83. Which of the following is correct ?

(A) Style sheets allow content to be optimized for more than one type of device.

(B) CSS can store web applications locally with the help of an offline cache.

(C) Using CSS, we can view offline websites. The cache also ensures faster loading and

better overall performance of the website.

(D) All of the above.

Ans: D

Q84. How to insert multiple line comments in a CSS file ?

(A) //statement

(B) „statement

(C) /* statement */

(D) // statement //

Ans: C

Q85. Which CSS property helps one to decide whether the text should be clipped, show some dots (ellipsis), or display a custom string ?

(A) Text-decoration

(B) Text-stroke

(C) Text-shadow

(D) Text-overflow

Ans: D

Q86. From the below mentioned CSS properties, which of the following is used to make the text bold?

(A) Text-align: bold

(B) Font-style: bold

(C) Font-weight: bold

(D) Text-decoration: bold

Ans: C

Q87. By using CSS style or code, how can one remove the underline from all hyperlinks ?

(A) a {text-decoration: no-underline;}

(B) a {text: no-underline;}

(C) a {text-decoration:none;}

(D) a {text-style: no-underline;} Ans: C

Q88. Which CSS attribute(s) should one use to create a pink dotted border around an image?

I. border-line

II. border-style

III. border-color

(A) I (B) II (C) III (D) Both II and III

Q89. Which of the following is true for pseudo class in CSS ?

 (A) Match A Specified Element

 (B) Select The Active Links

 (C) Are Used to Select All the Visited Links

 (D) Are Used to Define a Special State of An Element

Ans: D

Q90. What is the proper html syntax for referencing an external style sheet ?

 (A) <style src="demostyle.css”>

 (B) <stylesheet>demostyle.css</stylesheet/>

 (C) <link rel = “stylesheet” type= “text/css” href= “demostyle.css”>

 (D) None of these

Ans: C

Q91. To control image repetition in CSS , the correct option is :

(A) h1 { background-loop: none; }

 (B) h1 { background-repeat: none; }

 (C) h1 { background-iterate: none; }

 (D) None of the above

Ans: C


CSS MCQ YOUTUBE VIDEO:





1,283 views0 comments

Recent Posts

See All

IOT Arduino MCQ

Building IOT Applications MCQ: Q1. Which Microcontroller is used in Arduino UNO prototyping board? A.    ATmega328m B.     ATmega328p...

Introduction to IOT MCQ

Introductions to IOT MCQs Q1. Which is not a standard protocol used in IOT domain? A.      Wifi B.      Z-wave C.      Zigbee D.     ...

Comments


bottom of page