CSS Basics Quiz

Here are quizzes on CSS introduction, covering topics like CSS syntax, selectors, how to add CSS, and using comments in CSS for clear styling.

Last Updated :
Discuss
Comments

Question 1

Which of the following is NOT a use of CSS?

  • Creating responsive layouts

  • Animating HTML elements

  • Structuring the content of a web page

  • Setting background images

Question 2

Which of the following is the correct syntax to change the text color of a paragraph to blue?

  • p {color: blue;}

  • p {text-color: blue;}

  • p {font-color: blue;}

  • p {color: #0000FF;}

Question 3

Which selector is used to select all elements with the class "example"?

  • .example

  • #example

  • *example

  • example

Question 4

How do you add a comment in CSS?

  • // This is a comment

  • <!-- This is a comment -->

  • /* This is a comment */

  • # This is a comment

Question 5

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

  • bgcolor

  • background-color

  • color

  • background

Question 6

What is the correct CSS syntax to make all <h1> elements bold?

  • h1 {font-weight: bold;}

  • h1 {font-style: bold;}

  • h1 {text-weight: bold;}

  • h1 {font: bold;}

Question 7

Which of the following is the correct way to link an external CSS file to an HTML document?

  • <link rel="stylesheet" href="styles.css">

  • <style src="styles.css">

  • <css src="styles.css">

  • <script src="styles.css">

Question 8

Which CSS property controls the text size?

  • font-size

  • text-size

  • font-style

  • text-style

Question 9

How do you select an element with the id "header" in CSS?

  • #header

  • .header

  • header

  • *header

Question 10

What is the correct order of CSS inclusion from highest to lowest priority?

  • Inline, External, Internal

  • External, Internal, Inline

  • Internal, Inline, External

  • Inline, Internal, External

There are 10 questions to complete.

Take a part in the ongoing discussion