CSS MCQs – Introduction to CSS Fundamentals

Are you getting ready for a CSS interview and want to be well-prepared? Check out our guide on “CSS MCQs – Introduction to CSS Fundamentals” to help you get ready. We’ve put together multiple-choice questions covering important stuff like selectors, box models, and layout techniques. These questions test your knowledge of CSS, from basic to more advanced topics. Whether you’re just starting or you’ve been working with CSS for a while, our MCQs will help you get the hang of it all. With our guide, you’ll feel more confident and ready to tackle any CSS questions that come your way in the interview!

1.) What does CSS stand for?

A) Computer Style Sheets
B) Cascading Style Sheets
C) Creative Style Sheets
D) Colorful Style Sheets

Answer: Option B

Explanation: CSS stands for Cascading Style Sheets, which is used for styling the layout and appearance of web pages.

2.) Which CSS selector has the highest specificity?

A) Class selector
B) ID selector
C) Tag selector
D) Universal selector

Answer: Option B

Explanation: ID selectors have the highest specificity in CSS, followed by class selectors, tag selectors, and universal selectors.

3.) What is the correct order of the CSS box model?

A) Margin, Padding, Border, Content
B) Padding, Border, Width, Height
C) Border, Margin, Height, Width
D) Padding, Margin, Content, Border

Answer: Option A

Explanation: The correct order of the CSS box model is Margin, Padding, Border, and Content.

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

A) color
B) background-color
C) text-color
D) background

Answer: Option B

Explanation: The background-color property is used to change the background color of an element in CSS.

5.) Which CSS property is used to make text italic?

A) font-style
B) ext-style
C) italic
D) font-italic

Answer: Option A

Explanation: The font-style property with a value of italic is used to make text italic in CSS.

6.) Which of the following is an example of an inline CSS?

A) <link rel=”stylesheet” href=”styles.css”>
B) <style>body { color: red; } </style>
C) <body style=”color: blue;”>
D) .text { color: green; }

Answer: Option C

Explanation: An inline CSS example would be styling directly within the HTML tag.

7.) What is the default value of the position property in CSS?

A) relative
B) fixed
C) absolute
D) static

Answer: Option D

Explanation: The default value of the position property in CSS is static.

8.) Which CSS property is used to control the spacing between lines of text?

A) line-height
B) spacing
C) text-spacing
D) line-spacing

Answer: Option A

Explanation: The line-height property is used to control the spacing between lines of text in CSS.

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

A) font
B) text-size
C) size
D) font-size

Answer: Option D

Explanation: The font-size property is used to set the font size of an element in CSS.

10.) What is the correct way to link an external CSS file to an HTML document?

A) <style>styles.css</style>
B) <link rel=”stylesheet” href=”styles.css”>
C) <link>styles.css</link>
D) <css src=”styles.css”></css>

Answer: Option B

Explanation: The <link> element with the rel attribute set to stylesheet is used to link an external CSS file to an HTML document.

Leave a Reply

Your email address will not be published. Required fields are marked *