Css - Mock Interview Test
1. What is the correct syntax to change the background color of a page in CSS?
A. background-color: #ffffff;
B. color: #ffffff;
C. bgcolor: #ffffff;
D. background: #ffffff;
2. How do you add a comment in CSS?
A. // This is a comment
B. /* This is a comment */
C.
D. comment: "This is a comment"
3. Which property is used to set the space between the content and the border in CSS?
A. padding
B. margin
C. border-spacing
D. outline
4. What does the CSS "display: none" property do?
A. It hides the element but keeps the space it occupies
B. It removes the element from the document layout
C. It makes the element visible
D. It changes the element's font color
5. How do you center a block element in CSS?
A. margin: 0 auto;
B. text-align: center;
C. float: center;
D. display: block;
6. What is the CSS property to control the font size?
A. font-size
B. text-size
C. font-style
D. font-weight
7. Which of the following CSS properties is used to change the text color?
A. text-color
B. font-color
C. color
D. text-style
8. Which property is used to set the space between elements in CSS?
A. padding
B. margin
C. border
D. outline
9. What is the default value of the position property in CSS?
A. static
B. relative
C. absolute
D. fixed
10. Which of the following is used to apply styles to an element when the user hovers over it?
A. :hover
B. :focus
C. :active
D. :visited
11. What does the CSS 'z-index' property control?
A. The visibility of elements
B. The stacking order of elements
C. The alignment of elements
D. The color of elements
12. Which of the following is the correct way to select all
elements in CSS?
A. p {}
B. .p {}
C. #p {}
D. p[] {}
13. What is the correct syntax to add an external CSS file in an HTML document?
A.
B.
C.
D.
14. What does the CSS 'float' property do?
A. It arranges the element in a row or column
B. It removes the element from the flow of the document
C. It sets the visibility of the element
D. It changes the element's position relative to its parent
15. What does the CSS 'position: absolute' property do?
A. It places the element relative to its first positioned ancestor
B. It places the element relative to its normal position
C. It does not affect the element's position
D. It aligns the element to the left of the screen
16. Which CSS property is used to change the font family?
A. font-family
B. font-weight
C. font-style
D. text-transform
17. Which CSS property is used to set the opacity of an element?
A. opacity
B. visibility
C. transparency
D. filter
18. What is the CSS property to control the line height?
A. line-height
B. letter-spacing
C. text-align
D. word-spacing
19. What is the use of 'text-align: justify' in CSS?
A. Aligns text to the left
B. Aligns text to the right
C. Aligns text in the center
D. Aligns text to both the left and right margins
20. Which property is used to control the border style in CSS?
A. border-style
B. border-width
C. border-color
D. border-radius
Submit
Go Back