CSS
CSS (Cascading Style Sheets) is a language used to style and format HTML documents. It controls the appearance of web pages, including layout, colors, fonts, spacing, and positioning. CSS enhances user experience and separates content from design efficiently.
1. How can we change the background color of an element?
A) background-color ✅
B) color
C) Both A and B
D) None of these
2. Which is the correct CSS syntax?
A) body: color = black;
B) body {color: black;} ✅
C) {body: color : black;}
D) {body : color = black;}
3. How can we select an element with a specific ID in CSS?
A) # ✅
B) .
C) !
D) None of these
4. How can we select an element with a specific Class in CSS?
A) #
B) . ✅
C) !
D) None of these
5. Can negative values be allowed in padding property?
A) Yes
B) No ✅
C) Depends on property
D) None of these
6. The CSS property used to specify the transparency of an element is?
A) opacity ✅
B) visibility
C) filter
D) None of these
7. How can we specify the spacing between each letter in a text in CSS?
A) alpha-spacing
B) letter-spacing ✅
C) character-spacing
D) None of these
8. We can make rounded borders around element using which CSS element?
A) border-collapse
B) border-round
C) border-radius ✅
D) None of these
9. Which of the following property specifies the look and design of an outline?
A) outline-style ✅
B) outline
C) outline-font
D) None of these
10. Which of the following are valid CSS position property values?
A) static ✅
B) relative ✅
C) fixed ✅
D) All of these ✅
11. Which of the following CSS property is used to controlling the layout?
A) display ✅
B) color
C) text
D) None of these
12. Which of the following CSS property specifies the origin of the background image?
A) background-origin ✅
B) background-size
C) origin
D) None of these
13. How are custom fonts defined using CSS?
A) @font-face rule ✅
B) Custom fonts cannot be defined
C) src tags
D) None of these
14. Which of the following are parts of the CSS box model?
A) Margins
B) Borders
C) Padding
D) All of these ✅
15. Which of the following components of the CSS box model are transparent?
A) Padding
B) Margin
C) Both A and B ✅
D) Content
16. Which of the following can be achieved with CSS lists?
A) Set different list item markers for ordered lists
B) Set different list item markers for unordered lists
C) Set an image as the list item marker
D) All of these ✅
17. Which of the following CSS property specifies the type of list item marker?
A) list
B) list-style-type ✅
C) ul
D) ol
18. What value should be passed to the width parameter if we want an element, say a table, to span the entire width of the screen?
A) 100% ✅
B) 50%
C) 0%
D) None of these
19. Which of the following properties is used to align text in CSS?
A) text-align ✅
B) text-alignment
C) text
D) text-position
20. Which of the following is the correct approach to make a table responsive?
A) overflow-x: auto ✅
B) overflow-x: none
C) Both A and B
D) None of these
21. Which of the following CSS properties specifies the stack order of elements?
A) z-index ✅
B) overlap
C) No such specific properties is present
D) None of these
22. What are the uses of CSS pseudo-elements?
A) Style specified parts of an element
B) Style the first letter or line of an element
C) Insert content before or after the element
D) All of the above ✅
23. How can we select elements with a specified attribute in CSS?
A) [attribute] selector ✅
B) [property] selector
C) Both A and B
D) None of these
24. Which of the following are types of length units in CSS?
A) Absolute
B) Relative
C) Both A and B ✅
D) None of these
25. What parameter does the calc() function in CSS take?
A) A sentence
B) A mathematical expression ✅
C) A number
D) None of these
26. How can we add more importance to a property/value than normal?
A) !important ✅
B) important
C) bold
D) None of these
27. Which CSS property specifies the painting area of the background?
A) background-size
B) background-clip ✅
C) background-image
D) None of these
28. What are the different types of gradients in CSS?
A) Linear Gradients
B) Conic Gradients
C) Radial Gradients
D) All of these ✅
29. Which CSS property is used to create an image reflection?
A) box-reflect ✅
B) image-reflect
C) reflect-img
D) None of these
30. The transparent keyword is equivalent to which RGBA() value in CSS?
A) RGBA(0, 0, 0, 1)
B) RGBA(255, 255, 255, 1)
C) RGBA(0, 0, 0, 0) ✅
D) RGBA(255, 255, 255, 0)
31. What function is used to insert values of a CSS variable?
A) var() ✅
B) rand()
C) varchar()
D) calc()
32. What is the general syntax of writing the var() function?
A) var(–name, value) ✅
B) var(–name)
C) var(value)
D) None of these
33. The CSS property used to control the element’s font size is –
A) text-style
B) text-size
C) font-size ✅
D) None of these
34. The HTML attribute used to define the internal stylesheet is –
A) ✅
B) style
C)
D)
35. Which of the following is the correct syntax to make the background-color of all paragraph elements to yellow?
A) p {background-color : yellow;} ✅
B) p {background-color : #yellow;}
C) all {background-color : yellow;}
D) all p {background-color : #yellow;}
36. Which property is used to set the spacing between words in a paragraph?
A) word-spacing
B) letter-spacing ✅
C) word-break
D) text-align
37. Which property is used to make the text bold in CSS?
A) text-style
B) font-style
C) font-weight ✅
D) font-size
38. Which of the following properties is used to add shadow to text in CSS?
A) text-shadow ✅
B) box-shadow
C) shadow
D) None of these
39. What does the z-index property do in CSS?
A) It controls the font size
B) It controls the stacking order of elements ✅
C) It controls the width of an element
D) It controls the background image
40. Which of the following values can be used to set the display property to make an element not displayed on a webpage?
A) none ✅
B) hidden
C) block
D) inline
41. Which of the following CSS properties is used to change the background image of an element?
A) background-image ✅
B) background-style
C) background-color
D) None of these
42. Which property is used to control the transparency of an element in CSS?
A) opacity ✅
B) visibility
C) transparency
D) z-index
43. Which CSS property is used to change the font of an element?
A) font-family ✅
B) text-family
C) font-style
D) None of these
44. Which property is used to make the element’s content visible or hidden in CSS?
A) visibility ✅
B) display
C) opacity
D) visibility:hidden
45. How can we apply multiple CSS rules for the same element?
A) Use semicolons
B) Use commas
C) Use multiple selectors ✅
D) Use parentheses
46. What is the default value of the position property in CSS?
A) relative
B) static ✅
C) absolute
D) fixed
47. Which of the following CSS properties can be used to set a border around an element?
A) border-style
B) border-width
C) border-color
D) All of these ✅
48. Which of the following properties is used to control the size of an element’s border?
A) border-style
B) border-width ✅
C) border-color
D) None of these
49. Which of the following is the correct way to add a comment in CSS?
A) // This is a comment
B) / This is a comment / ✅
C) # This is a comment
D) <!– This is a comment –>
50. Which CSS property is used to control the layout?
A) display ✅
B) color
C) text
D) None of these
51. Which property specifies the origin of the background image?
A) background-origin ✅
B) background-size
C) origin
D) None of these
52. How are custom fonts defined using CSS?
A) @font-face rule ✅
B) Custom fonts cannot be defined
C) src tags
D) None of these
53. Which of the following are parts of the CSS box model?
A) Margins
B) Borders
C) Padding
D) All of these ✅
54. Which of the following components of the CSS box model are transparent?
A) Padding
B) Margin
C) Both A and B ✅
D) Content
55. Which of the following can be achieved with CSS lists?
A) Set different list item markers for ordered lists
B) Set different list item markers for unordered lists
C) Set an image as the list item marker
D) All of these ✅
56. Which of the following CSS property specifies the type of list item marker?
A) list
B) list-style-type ✅
C) ul
D) ol
57. What value should be passed to the width parameter if we want an element, say a table, to span the entire width of the screen?
A) 100% ✅
B) 50%
C) 0%
D) None of these
58. Which of the following properties is used to align text in CSS?
A) text-align ✅
B) text-alignment
C) text
D) text-position
59. Which of the following is the correct approach to make a table responsive?
A) overflow-x: auto ✅
B) overflow-x: none
C) Both A and B
D) None of these
60. Which of the following CSS properties specifies the stack order of elements?
A) z-index ✅
B) overlap
C) No such specific properties is present
D) None of these
61. What are the uses of CSS pseudo-elements?
A) Style specified parts of an element
B) Style the first letter or line of an element
C) Insert content before or after the element
D) All of the above ✅
62. How can we select elements with a specified attribute in CSS?
A) [attribute] selector ✅
B) [property] selector
C) Both A and B
D) None of these
63. Which of the following are types of length units in CSS?
A) Absolute
B) Relative
C) Both A and B ✅
D) None of these
64. What parameter does the calc() function in CSS take?
A) A sentence
B) A mathematical expression ✅
C) A number
D) None of these
65. How can we add more importance to a property/value than normal?
A) !important ✅
B) important
C) bold
D) None of these
66. Which CSS property specifies the painting area of the background?
A) background-size
B) background-clip ✅
C) background-image
D) None of these
67. What are the different types of gradients in CSS?
A) Linear Gradients
B) Conic Gradients
C) Radial Gradients
D) All of these ✅
68. Which CSS property is used to create an image reflection?
A) box-reflect ✅
B) image-reflect
C) reflect-img
D) None of these
69. The transparent keyword is equivalent to which RGBA() value in CSS?
A) RGBA(0, 0, 0, 1)
B) RGBA(255, 255, 255, 1)
C) RGBA(0, 0, 0, 0) ✅
D) RGBA(255, 255, 255, 0)
70. What function is used to insert values of a CSS variable?
A) var() ✅
B) rand()
C) varchar()
D) calc()
71. What is the general syntax of writing the var() function?
A) var(–name, value) ✅
B) var(–name)
C) var(value)
D) None of these
72. The CSS property used to control the element’s font size is –
A) text-style
B) text-size
C) font-size ✅
D) None of these
73. The HTML attribute used to define the internal stylesheet is –
A) ✅
B) style
C)
D)
74. Which of the following is the correct syntax to make the background-color of all paragraph elements to yellow?
A) p {background-color : yellow;} ✅
B) p {background-color : #yellow;}
C) all {background-color : yellow;}
D) all p {background-color : #yellow;}
75. What does the transition property in CSS do?
A) Defines background effects
B) Enables smooth change from one style to another ✅
C) Changes text font
D) Hides an element
76. Which value of display removes an element from the page layout?
A) none ✅
B) hidden
C) invisible
D) collapse
77. What is the default display value of a tag?
A) inline
B) block ✅
C) flex
D) inline-block
78. Which pseudo-class selects when a user hovers over an element?
A) hovering
B) :hover ✅
C) :focus
D) :target
79. How do you apply styles to a specific ID in CSS?
A) .idname
B) #idname ✅
C) id:idname
D) *idname