top of page

CSS MCQ Questions with Answer

Updated: Sep 15, 2022


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?


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.