Short Questions for Cascading Style Sheets (CSS)

  • 1 Discuss the type of attribute selectors with examples.

    Answer:

    • Existence selector : Check the existence of an attribute in the tag for example p[id]
    • Equality selector: Ensure to select tags with the specified value of an attribute. e.g. p[id="summary"]
    • Space selector: Look for values with space separated words, one of which is exactly the specified word. e.g. p[calss~="xhtml"]
    • Hyphen selector: Helps in selecting the tags based on the value of attributes start with a specific character sequence. e.g. p[language|="en"]
    • Prefix selector (CSS3): select tags with any value of attribute begins with specified characters. e.g. p[attr^"b"]
    • Substring selector (css3): Looks for contains in the value of attribute e.g. p[attr*"b"]
    • Suffix selector (css3): Looks for attribute value ends in specified value. e.g. p[attr$"x"]


  • 2 Describe the following selectors with example. 
    • The Descendant selector 
    • The Adjacent Sibling Selector 
    • The General Sibling Selector

    Answer:

    The Descendant Selector: This selector matches an element type that is a descendant of another specified element (or nested inside another specified element), not just a direct child. 

    Example: table b {} 
    The Adjacent Sibling Selector: This selector matches an element type that is the next sibling of another. 
    Example: h1+p {} 
    The General Sibling Selector: This selector matches an element type that is a sibling of another, although it does not have to be the directly preceding element 
    Example: h1~p {}


  • 3 Find and write the names for the type of selector applied on this text of the question.

    Answer:

    The following selectors were applied on the text of the question: 

    • Element/Type Selector 
    • Grouping Selector 
    • Class Selector 
    • Universal Selector


  • 4 Name at least five CSS selectors with examples?

    Answer:

    Grouping:

    Universal Selector

    *.warning and .warning are equivalent

    Type Selectors:

    h1 { font-family: sans-serif }

    Id Selector:

    #para1

    {text-align:center;color:red;}

    Child Selector:

    td > b {}




  • 5 What are the advantages of external style sheet?

    Answer:

    The advantages of external style sheet are as follows

    (1)It saves you repeating the same style rules in each page.

    (2)You can change the appearance of several pages by altering just the style sheet rather than each individual page.

    (3)Once a visitor to your site has downloaded the CSS style with the first page of your

    site that uses it, subsequent pages will be quicker to load.

    (4)Because the web pages do not contain the style rules, different style sheets can be

    attached to the same document.


  • 6 What are the advantages of External style sheet?

    Answer:

    • It saves you repeating the same style rules in each page
    • You can change the appearance of several pages by altering just the style sheet rather than each individual page.
    • Once a visitor to your site has downloaded the CSS style with the first page of your site that uses it, subsequent pages will be quicker to load.
    • Because the web pages do not contain the style rules, different style sheets can be attached to the same document.


Contact Us

support@subexpert.com
Write to Us View Help
Subject Expert Logo

Subject Expert

Learn and Evaluate

Follow Us
© 2020 - Subject Expert