CSS Questions & Answers – CSS and (X)HTML Elements Fundamentals

This set of CSS Interview Questions and Answers for Experienced people focuses on “CSS and (X)HTML Elements Fundamentals”.

1. Which of the following elements are block and inline elements, respectively, that have no particular rendering?
a) div
b) span
c) box-model
d) both div and span
View Answer

Answer: d
Explanation: The div element and span element are block and inline elements, respectively, that have no particular rendering. You might call them generic tags. Because these tags don’t have any predefined meaning or rendering, they are very useful for arbitrary style duties.

2. The _____________ property specifies the background color of an element.
a) background-color
b) border
c) color
d) display
View Answer

Answer: a
Explanation: Example:

body {
    background-image: url("img_tree.png");
    background-repeat: no-repeat;
}

3. The ___________ property specifies if/how an element is displayed.
a) background-color
b) border
c) color
d) display
View Answer

Answer: d
Explanation: Example:

advertisement
advertisement
h1.hidden {
    display: none;
}

4. The _____________ property allows us to include the padding and border in an element’s total width and height.
a) margin
b) box-sizing
c) padding
d) none of the mentioned
View Answer

Answer: b
Explanation: Example:

.div1 {
    box-sizing: border-box;
}

5. ____________ property sets the coordinates of the clipping shape that exposes or hides the content of absolutely positioned elements
a) clammper
b) clip
c) clear
d) none of the mentioned
View Answer

Answer: b
Explanation:

advertisement
clip: rect(coordinates) | auto | inherit

6. _____________ property defines the space between cells in a table.
a) border
b) border-spacing
c) border-style
d) none of the mentioned
View Answer

Answer: b
Explanation:

advertisement
border-spacing: non-negative length(s) | inherit

7. ____________ property defines whether table cell borders are connected or separate.
a) border-color
b) border
c) border-style
d) none of the mentioned
View Answer

Answer: d
Explanation: border-collapse roperty defines whether table cell borders are connected or separate.

8. ________________ property sets the background image to scroll or not to scroll with its associated element’s content
a) background
b) background-position
c) background-attachment
d) none of the mentioned
View Answer

Answer: c
Explanation: Example:

background-attachment: scroll | fixed | inherit

9. ____________ property associates a background image with an element.
a) image
b) background-image
c) float
d) none of the mentioned
View Answer

Answer: b
Explanation: Example:

background-image: url(image-file) | none | inherit

10. ______________ property defines whether table cell borders are connected or separate.
a) pre
b) border-color
c) border-collapse
d) table
View Answer

Answer: c
Explanation: Example:

border-collapse: collapse | separate | inherit

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.