CSS Syntax Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Jayvanburen
J
Jayvanburen
Community Contributor
Quizzes Created: 1 | Total Attempts: 2,162
Questions: 7 | Attempts: 2,164

SettingsSettingsSettings
CSS Syntax Quiz - Quiz

This is a test of CSS syntax meant as a review for advanced web design students to make sure they've not forgotten anything. Assume that the css you're looking at is in a separate. Css file that is linked correctly to an html page.


Questions and Answers
  • 1. 

    What does the following mean to the computer? div p {color: #ff0000;}

    • A.

      Make text in all divs and all paragraphs in this document be bright red

    • B.

      Make the background in all divs that are of the class "p" be bright red

    • C.

      Make the text inside any divs inside of any paragraph be bright red

    • D.

      Make the text inside any paragraph that is inside any div be bright red

    Correct Answer
    D. Make the text inside any paragrapH that is inside any div be bright red
    Explanation
    The given CSS code "div p {color: #ff0000;}" means that the text inside any paragraph that is inside any div should be colored bright red. This selector targets all paragraphs that are nested within a div element and applies the specified color to their text.

    Rate this question:

  • 2. 

    Look at the following HTML: what is the MOST SIMPLE way that you could make the words "jay's favorite" and only those words red without making any of the other text in the page red as well?

    • A.

      Span {color:#ff0000;}

    • B.

      Li {color:#ff0000;}

    • C.

      Li span {color:#ff0000;}

    • D.

      Div ul li span {color:#ff0000;}

    • E.

      Li, span {color:#ff0000;}

    Correct Answer
    C. Li span {color:#ff0000;}
    Explanation
    The correct answer is "li span {color:#ff0000;}". This is because the selector "li span" selects the span element that is a descendant of an li element. By applying the CSS rule "color:#ff0000;", only the words "jay's favorite" within the span element inside the li element will be made red, without affecting any other text on the page.

    Rate this question:

  • 3. 

    What does the following mean to the computer? div.leftnav a, div.bottomnav a {text-decoration:none;}

    • A.

      Make the text inside any anchor tags that are inside either a div with the class "leftnav" or the class "bottomnav" have no text decoration

    • B.

      Make an anchor tag that is inside a div with the class "bottomnav" which is inside a div with the class "leftnav" have no text decoration

    • C.

      Make the text inside any anchor tags that are inside either a div with the ID "leftnav" or the ID "bottomnav" have no text decoration

    • D.

      All of the above

    Correct Answer
    A. Make the text inside any anchor tags that are inside either a div with the class "leftnav" or the class "bottomnav" have no text decoration
    Explanation
    The given CSS code selects all anchor tags that are inside either a div with the class "leftnav" or the class "bottomnav" and applies the style rule "text-decoration:none;" to them. This means that the text inside these anchor tags will not have any text decoration, such as underlining or strikethrough. The code does not specify any IDs, so it is not selecting based on IDs. Therefore, the correct answer is "make the text inside any anchor tags that are inside either a div with the class 'leftnav' or the class 'bottomnav' have no text decoration."

    Rate this question:

  • 4. 

    Here we have 4 different blocks of code. Each one contains the text "hello". Which of the following would display without an underline if this rule were in the stylesheet for this page? .leftnav #mylink a {text-decoration:none;}

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    • E.

      Either a or c

    Correct Answer
    A. A
    Explanation
    The correct answer is "a" because it is the only block of code that matches the CSS rule in the stylesheet, which sets the text-decoration property to none. This rule removes the underline from the text, so only the block of code that matches the rule will display without an underline. The other blocks of code do not have the necessary selectors or properties to remove the underline.

    Rate this question:

  • 5. 

    DIVs should only use ID's and spans should only use Classes

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    This statement is false. In HTML, both DIVs and spans can use either IDs or classes. IDs are typically used to uniquely identify a specific element on a page, while classes are used to group multiple elements together. Both IDs and classes can be used with both DIVs and spans, depending on the specific use case and styling requirements.

    Rate this question:

  • 6. 

    What are the main differences between ID and Class

    • A.

      Classes are for use with spans and ID's are for use with DIVs

    • B.

      ID's are supposed to be only used once per page but Classes can be used multiple times per page, and one element can have more than one Class but should have only one ID

    • C.

      Classes should be used only once per page, but ID's can be used as many times as you like on one page

    • D.

      ID's are better than Classes

    Correct Answer
    B. ID's are supposed to be only used once per page but Classes can be used multiple times per page, and one element can have more than one Class but should have only one ID
    Explanation
    The main difference between ID and Class is that ID's are supposed to be used only once per page, while Classes can be used multiple times per page. Additionally, one element can have more than one Class, but should have only one ID.

    Rate this question:

  • 7. 

    (this is not strictly about CSS, but what the heck) What is the main difference between a DIV and a SPAN ?

    • A.

      Spans are, by default, inline and DIVs are by default Block

    • B.

      DIVs are, by default, inline and SPANs are by default Block

    • C.

      There is no real difference

    • D.

      Spans can be inside DIVs but DIVs are not supposed to go inside spans

    • E.

      Both a and d

    Correct Answer
    E. Both a and d
    Explanation
    The main difference between a DIV and a SPAN is that by default, SPANs are inline elements and DIVs are block elements. This means that SPANs are typically used for smaller, inline elements within a block of text, while DIVs are used for larger sections or divisions of content. Additionally, SPANs can be nested inside DIVs, but DIVs are not supposed to be nested inside SPANs. Therefore, the correct answer is "both a and d".

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 19, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 08, 2009
    Quiz Created by
    Jayvanburen
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.