Here are Top 25 multiple-choice questions (MCQs) focused on the HTML5 features and elements in CSS (Cascading Style Sheets) MCQs, along with their answers and explanations.

PRACTICE IT NOW TO SHARPEN YOUR CONCEPT AND KNOWLEDGE

view hide answers

1. What does CSS stand for?

  • Computer Style Sheets
  • Creative Style Sheets
  • Cascading Style Sheets
  • Colorful Style Sheets

2. Which HTML tag is used to include an external CSS file in an HTML document?

  • `<style>`
  • `<link>`
  • `<script>`
  • `<css>`

3. What is the primary purpose of CSS?

  • To create dynamic web content
  • To define the structure of a webpage
  • To enhance the functionality of web pages
  • To control the visual presentation of web pages

4. What is the selector in CSS used for?

  • To specify which HTML elements are affected by the style rule
  • To define a new CSS property
  • To create a comment in the CSS code
  • To include external CSS files

5. What does the term "Cascading" refer to in CSS?

  • It means that styles can be applied in layers or levels
  • It refers to the use of multiple style sheets in a single document
  • It signifies the process of style inheritance and overwriting
  • It denotes a specific CSS property

6. Which CSS property is used to change the background color of an element?

  • `text-color`
  • `foreground-color`
  • `background-color`
  • `color`

7. In CSS, what is the purpose of the "property" in a style rule?

  • To define the elements affected by the rule
  • To specify the value of the style
  • To select the style rule
  • To create a comment in the CSS code

8. What is the default behavior of a browser if CSS is not applied to an HTML document?

  • The browser displays a blank page
  • The browser uses the default browser styles
  • The browser prompts the user to define styles
  • The browser refuses to load the page

9. Which CSS property is used to specify the font of an element's text?

  • `font-family`
  • `text-font`
  • `font-type`
  • `text-family`

10. What is the purpose of the "value" in a CSS style rule?

  • To define the elements affected by the rule
  • To select the style rule
  • To specify the style property
  • To specify the style property's value

11. Which CSS selector targets all HTML elements of a specific type, such as all paragraphs (`<p>`) in a document?

  • Universal Selector (*)
  • Element Selector
  • Class Selector
  • ID Selector

12. What does the term "stylesheet" refer to in CSS?

  • A web page's content
  • The HTML structure of a document
  • The CSS code applied to a document
  • The external CSS file used to style a document

13. What is the purpose of the "class" attribute in HTML and CSS?

  • To create a comment in the HTML code
  • To identify unique elements in a document
  • To apply a specific style to multiple elements
  • To define a new HTML element

14. What is the role of the "ID" selector in CSS?

  • To select multiple elements with the same identifier
  • To create a comment in the CSS code
  • To select a single unique element in a document
  • To define a new CSS property

15. Which CSS property is used to control the spacing between lines of text within an element?

  • line-height
  • text-spacing
  • line-spacing
  • text-line

16. What is the purpose of the "margin" property in CSS?

  • To set the background color of an element
  • To define the space around an element
  • To change the font of text
  • To control the text alignment

17. Which CSS property is used to specify the size of an element's text, relative to its parent element's font size?

  • font-size
  • text-size
  • size
  • font-relative

18. What is the role of the "pseudo-class" in CSS?

  • To select elements based on their attribute values
  • To create animations and transitions
  • To apply styles to specific states of an element
  • To define custom HTML elements

19. What is the purpose of the "float" property in CSS?

  • To control the spacing between lines of text
  • To align text within an element
  • To specify the position of an element relative to its parent
  • To change the background color of an element

20. What does the term "box model" refer to in CSS?

  • The model used for creating 3D shapes in CSS
  • The representation of boxes used in CSS layouts
  • The model for creating animation effects in CSS
  • The CSS syntax for defining styles

21. Which CSS property is used to apply a shadow effect to an element, providing depth and dimension?

  • text-shadow
  • box-shadow
  • element-shadow
  • shadow-effect

22. What is the purpose of the "media query" in CSS?

  • To define a new media type
  • To apply styles based on the device's screen size and features
  • To create transitions and animations
  • To change the font of text

23. What CSS property is used to control the alignment of text within an element?

  • text-align
  • text-center
  • text-justify
  • text-position

24. In CSS, what is the purpose of the "z-index" property?

  • To change the font of text
  • To control the visibility of an element
  • To specify the position of an element in the z-axis
  • To create transitions and animations

25. What CSS property is used to define the appearance of the border around an element?

  • border-color
  • border-style
  • border-width
  • border

Share with : Share on Linkedin Share on Twitter Share on WhatsApp Share on Facebook