CSS Questions & Answers – The Specification of CSS

This set of CSS Interview Questions and Answers focuses on “The Specification of CSS”.

1. ___________ describes CSS properties to manipulate the position of “ruby”, which are small annotations on top of or next to words, especially common in Chinese and Japanese.
a) align
b) ruby
c) lang
d) text-align
View Answer

Answer: b
Explanation: Align is used to align the content either left, right or center. Ruby describes CSS properties to manipulate the position of “ruby”, which are small annotations on top of or next to words, especially common in Chinese and Japanese. They are often used to give the pronunciation or meaning of difficult ideograms. Text-align is for aligning the text either left, right or in center.

2. ___________ has a grammar but unlike traditional (X)HTML it is not defined with a document type definition.
a) CSS 1
b) CSS 2
c) CSS 2.1
d) CSS 3
View Answer

Answer: c
Explanation: CSS 2.1 has a grammar (www.w3.org/TR/CSS21/grammar.html) but unlike traditional (X)HTML it is not defined with a document type definition. Instead the CSS specification is a combination of prose and a grammar that could be used to build a simple parser.

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

advertisement
advertisement
h1 {color: red text-decoration: underline; font-style: italic;}

a) color: red, text-decoration: underline and font-style: italic all works
b) text-decoration: underline and font-style: italic works
c) color: red, text-decoration: underline works
d) only font-style: italic works
View Answer

Answer: d
Explanation: In this case, we should see the browser continue to parse the value of color as “red textdecoration:
underline” before it sees a closing semicolon. The font-style property that follows would then be used. Because the color property has an illegal value, it should be
ignored.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

 h1 {color: "green";}

a) heading becomes green
b) heading becomes dark-green
c) error occors
d) nothings happen
View Answer

Answer: d
Explanation: Output of above code snippet won’t happen as the declaration syntax is wrong. The correct declaration is : h1 { color: green; } which will yeild an output. In CSS, we don’t write value in double quotes.
advertisement

5. 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: We can style the document using CSS in three different ways i.e embed, inline and external. In any way as mentioned, we can apply CSS. An inline CSS means applying styles rules directly to the element. In embed, we declare or write all the needed style in <style></style> tag in the head element of the document. Expect these two ways we can also use another way in which we can create an external style sheet and provide its link to the document.
advertisement

6. With, which tag you write the style rules directly within the document found
within the head of the document.

a) <script>
b) <php> 
c) <style>
d) <css>
View Answer
Answer: c
Explanation: In <style></style> tag we write the style rules directly within the document in the head section of the document. <script></script> tag is used to add javascript in the document.
 
 

7. What does screen media type is used for?
a) For use with all devices
b) For use with handheld devices
c) For use with computer screens
d) For use with television-type devices
View Answer

Answer: c
Explanation: In CSS, media types are used for the compatibility of devices. There are four types of nedia types i.e all, print, screen and speech. Out of which screen media type is used for computer screens, tablets, smart-phones, etc.

8. For Inline Style, we don’t need to reapply style information throughout the document and outside documents.
a) True
b) False
View Answer

Answer: b
Explanation: In inline style, properties are confined with a particular element to which it is applied. It won’t be applied to other element of the same type. We need to reapply style information throughout the document whenever it is necessary.

9. Inline style has the lowest priority
a) True
b) False
View Answer

Answer: b
Explanation: Among inline, embed and external style ways, inline has the highest priority and it overrides the other.

10. For External Style Sheets in some cases when @import is used, the browser may cause a rendering “flash” under slow loading conditions.
a) True
b) False
View Answer

Answer: a
Explanation: External Style Sheets in some cases when @import is used the browser may cause a rendering “flash” under slow loading conditions.

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.