Debug School

Akanksha
Akanksha

Posted on

Top 30 CSS Interview Questions with Answers

1. What does CSS stand for?

a. Cascading Style Sheets
b. Computer Style Sheets
c. Creative Style Sheets
d. Complex Style Sheets
Answer: a. Cascading Style Sheets

2. Which CSS property is used to control the spacing between elements?

a. padding
b. margin
c. spacing
d. border
Answer: b. margin

3. Which CSS property is used to change the color of text?

a. text-color
b. color
c. font-color
d. text-style
Answer: b. color

4. Which CSS property is used to make an element bold?

a. font-weight
b. bold
c. text-bold
d. font-bold
Answer: a. font-weight

5. Which CSS property is used to set the background color of an element?

a. background-color
b. background
c. color
d. bg-color
Answer: a. background-color

6. What is the CSS property used for controlling the style of bullets in a list?

a. list-style-type
b. list-type
c. bullet-style
d. style-list
Answer: a. list-style-type

7. Which CSS property is used to control the display behavior of an element based on its content?

a) display-mode
b) display-behavior
c) display-type
d) display
Answer: d) display

8. How can you make an element stick to the top of the viewport even when the user scrolls down?

a) position: sticky;
b) position: fixed;
c) position: absolute;
d) position: top;
Answer: a) position: sticky;

9. How can you make a CSS style apply only to a specific media type, such as print or screen?

a) media-type: print;
b) screen-type: apply;
c) @media print {
d) apply-to: print;
Answer: c) @media print {

10. What is the purpose of the CSS property "overflow: hidden;"?

a) It hides the entire element
b) It hides the overflow content of an element
c) It makes the element's background transparent
d) It hides the element's border
Answer: b) It hides the overflow content of an element

11. Which CSS property is used for making text italic?

a. font-style
b. text-style
c. italicize
d. font-italic
Answer: a. font-style

12. What CSS property is used to control the size of an element's border?

a. border-width
b. border-size
c. border-style
d. border-height
Answer: a. border-width

13. What is the CSS property used for controlling the space between the content and the border of an element?

a. padding
b. margin
c. spacing
d. border-space
Answer: a. padding

14. Which CSS value is used for creating a responsive design that adapts to different screen sizes?

a. responsive
b. fluid
c. flexible
d. adaptive
Answer: b. fluid

15. Which CSS property is used to set the font size of an element?

a. font-size
b. text-size
c. size
d. font-style
Answer: a. font-size

16. Which CSS property is used to align text to the center of an element?

a. text-align
b. align-text
c. center-text
d. text-center
Answer: a. text-align

17. Which CSS property is used to display an element as a block-level container?

a. display: block;
b. display: inline;
c. display: flex;
d. display: container;
Answer: a. display: block;

18. Which CSS property is used to set the order of flexible items in a flex container?

a. order
b. flex-order
c. item-order
d. flex-item-order
Answer: a. order

19. What CSS property is used for creating shadows around elements?

a. box-shadow
b. shadow
c. element-shadow
d. shadow-box
Answer: a. box-shadow

20. Which CSS property is used to make text have no underlines or strike-throughs?

a. text-decoration
b. text-style
c. text-transform
d. text-effect
Answer: a. text-decoration

21. Which CSS property is used to specify the type of cursor to be displayed?

a. cursor-type
b. mouse-cursor
c. cursor
d. pointer
Answer: c. cursor

22. What CSS property is used for controlling the layout of table cells?

a. table-cell-layout
b. cell-layout
c. layout
d. display
Answer: d. display

23. Which CSS property is used to control the visibility of an element?

a. visibility
b. display
c. show
d. hidden
Answer: a. visibility

24. Which CSS pseudo-class is used to apply styles to a link that has been visited?

a. :visited
b. :active
c. :hover
d. :link
Answer: a. :visited

25. Which CSS property is used to set the height and width of an element as a percentage of its containing element?

a. width
b. height
c. percentage
d. dimension
Answer: a. width

26. What does the CSS property float do?

a. Positions an element absolutely
b. Aligns elements vertically
c. Specifies how an element should float
d. Sets the opacity of an element
Answer: c. Specifies how an element should float

27. Which CSS property is used to create rounded corners for an element?

a. border-radius
b. corner-radius
c. rounded-border
d. radius
Answer: a. border-radius

28. Which CSS property is used to set the distance between the lines of text within an element?

a. line-height
b. text-spacing
c. line-spacing
d. text-height
Answer: a. line-height

29. Which CSS property is used to set the style of the border of an element?

a. border-style
b. style
c. border
d. border-width
Answer: a. border-style

30. What is the CSS property used to control the order of items in a flex container?

a. order
b. flex-order
c. item-order
d. flex-item-order
Answer: a. order

Top comments (0)