CSS Programming MCQs

59
Score: 0
Attempted: 0/59
1. Which CSS property specifies the type of positioning method used for an element?



2. What is the default position value for HTML elements?



3. Which CSS property controls the stack order of elements?



4. Which z-index value brings an element to the top of the stack?



5. Which CSS property specifies how to handle content that overflows an element’s box?



6. Which overflow value adds scrollbars only when content overflows?



7. Which CSS property moves an element to the left or right of its container?



8. Which float value removes an element from normal flow and moves it to the right?



9. What is the effect of display: inline-block;?



10. Which CSS property aligns inline elements vertically within a line?



11. Which CSS property aligns flex items along the main axis?



12. Which combinator selects elements that are direct children of a specified element?



13. Which combinator selects an element that is immediately preceded by a sibling element?



14. Which combinator selects all siblings after a specified element?



15. Which CSS position value allows an element to move relative to its normal position?



16. Which positioning value fixes an element relative to the browser window?



17. Which position value allows an element to stick based on scroll but only within its container?



18. What does overflow: hidden; do?



19. Which property can reset a floated element to normal flow?



20. Which vertical-align value aligns the baseline of an element with the baseline of its parent?



21. #21: Which pseudo-class targets an element when a user hovers over it?



22. Which pseudo-class applies styles to the first child of its parent?



23. Which pseudo-class targets elements that are being clicked or activated?



24. Which pseudo-class targets a form input that currently has focus?



25. Which pseudo-class selects all checked checkboxes or radio buttons?



26. Which pseudo-class applies styles to elements that are the nth child of their parent?



27. Which pseudo-class selects elements that are not targeted by another selector?



28. Which pseudo-element is used to insert content before an element’s content?



29. Which pseudo-element is used to style the first letter of an element?



30. Which pseudo-element is used to style the first line of a block of text?



31. Which pseudo-element inserts content after an element’s content?



32. Which pseudo-class selects only elements that have no children?



33. Which pseudo-class selects elements that are enabled?



34. Which pseudo-class selects the last child of its parent?



35. Which pseudo-element can be used to style the placeholder text inside an input field?



36. Which pseudo-class targets links that have already been visited?



37. Which pseudo-class applies styles to links that have not yet been visited?



38. Which pseudo-class selects elements that are the only child of their parent?



39. Which pseudo-class targets elements that are invalid according to form validation?



40. Which pseudo-element can be used to style text selection by the user?



41. Which CSS property is used to set the transparency level of an element?



42. What is the range of values for the CSS opacity property?



43. Which CSS property can also be used to adjust opacity using RGBA colors?



44. Which CSS property is commonly used to create horizontal navigation links?



45. How can a dropdown menu be displayed on hover using CSS?



46. Which property ensures the dropdown menu is hidden by default?



47. Which CSS layout method is commonly used for image galleries?



48. Which CSS property can be used to create spacing between images in a gallery?



49. What is an image sprite?



50. Which CSS property is used to display a specific part of an image sprite?



51. Which CSS property prevents the background image from repeating?



52. Which attribute selector targets elements with a specific attribute, regardless of its value?



53. Which attribute selector targets elements whose attribute value is exactly equal to a specified value?



54. Which attribute selector targets elements whose attribute value starts with a specified value?



55. Which attribute selector targets elements whose attribute value ends with a specified value?



56. Which attribute selector targets elements whose attribute value contains a specified substring?



57. Which attribute selector targets elements whose attribute value is either exactly equal to a value or starts with a value followed by a hyphen?



58. Which CSS property is commonly used to create hover effects in navigation bars?



59. In an image gallery using flexbox, which property evenly spaces items along the main axis?



Contents Copyrights Reserved By T4Tutorials