CSS Questions & Answers – Applying Style to a Document

This set of CSS Interview Questions and Answers for freshers focuses on “Applying Style to a Document”.

1. Which of the following is the correct way to applying style to a document?
a) Use an external style sheet, either by importing it or by linking to it
b) Directly embed a document-wide style in the head element of the document
c) Set an inline style rule using the style attribute directly on an element
d) All of the mentioned
View Answer

Answer: d
Explanation: None.

2. What will be the output of following code snippet?

<style h1 {color: green;}> 
<h1>Hello</h1>

a) h1 heading becomes green
b) error
c) h1 heading disappears
d) nothing happens
View Answer

Answer: c
Explanation: None.
advertisement
advertisement

3. What will be the output of below mentioned code snippet?

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
<p style="color: red">text</p>

a) make that specific paragraph red.
b) error
c) nothing happens
d) none of the mentioned
View Answer

Answer: a
Explanation: NOne.
advertisement

4. The _______property is used to set the color of the text.
a) pallet
b) colour
c) color
d) text-decoration
View Answer

Answer: c
Explanation: None

5. Which of the following is the correct way to apply Styles?
a) inside an HTML element
b) inside the section of an HTML page
c) in an external CSS file
d) all of the mentioned
View Answer

Answer: d
Explanation: None.
advertisement

6. Which of the following CSS list properties is/are correct?
a) Set different list item markers for ordered lists
b) Set different list item markers for unordered lists
c) Set an image as the list item marker
d) All of the mentioned
View Answer

Answer: d
Explanation: None.

7. A ___________ is used to define a special state of an element.
a) pseudo-tag
b) pseudo-element
c) pseudo-id
d) pseudo-class
View Answer

Answer: d
Explanation: None.

8. The __________ property specifies the type of positioning method used for an element.
a) align
b) float
c) position
d) padding
View Answer

Answer: c
Explanation: None.

9. Which style is this?

<body style="background-color: lightcyan">

a) Inline Styles
b) External Style Sheet
c) External Style Sheettyle Sheet
d) None of the mentioned
View Answer

Answer: a
Explanation: None.

10. Is this correct way to apply css.State true or false.

<link rel="stylesheet" type="text/css" href="mystyle.css">

a) True
b) False
View Answer

Answer: a
Explanation: None.

Sanfoundry Global Education & Learning Series – CSS.

To practice all areas of CSS for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.