CSS Questions & Answers – Applying Style to a Document

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

Q 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

Show Answer Answer:-D. All of the mentioned

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

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

A. h1 heading becomes green
B. h1 heading disappears
C. nothing happens
D. error

Show Answer Answer:-B. h1 heading disappears

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

<p style="color: red">text</p>

A. make that specific paragraph red.
B. error
C. nothing happens
D. none of the mentioned
View Answer

Show Answer Answer:-A. make that specific paragraph red.

Q 4. The _______property is used to set the color of the text.
A. pallet
B. colour
C. color
D. text-decoration

Show Answer Answer:-C. color

Q 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

Show Answer Answer:-D. all of the mentioned

Q 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

Show Answer Answer:-D. All of the mentioned

Q 7. A ___________ is used to define a special state of an element.
A. pseudo-tag
B. pseudo-element
C. pseudo-class
D. pseudo-id

Show Answer Answer:-C. pseudo-class

Q 8. The __________ property specifies the type of positioning method used for an element.
A. align
B. float
C. position
D. padding

Show Answer Answer:-C. position

Q 9. Which style is this?

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

A. External Style Sheet
B. Inline Styles
C. External Style Sheettyle Sheet
D. None of the mentioned

Show Answer Answer:-B. Inline Styles

Q 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

Show Answer Answer:-A. True

Comments

Leave a Reply

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

You cannot copy content of this page