CSS Attribute Selectors


  1. Which of the following selector applies styles to elements that are valid per HTML5 validations set either with the pattern or type
    attributes?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Example: :valid {color: green;}


  1. Which of the following selectors selects adjacent siblings?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    h1 + p {color: red;}
    /* makes all p tags that are
    immediately preceded by an h1 tag
    red */



  1. By applying an ___________ a style can be applied to just a single tag.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    By applying an id rule, a style can be applied to just a single tag. For example, if we name a tag with a unique id attribute as follows
    <tag id="id-value">Affected Text</tag>


  1. The _____________ attribute is used to define the name(s) of the class(es) to which a particular tag belongs.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    class



  1. What will be the output of below mentioned code snippet?
    p strong {background-color: yellow;}











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    All occurrences of the strong element within a p element have a yellow background.