CSS interview questions

CSS quiz questions

  • 1.

    What is contextual selector?

    Answer:

    Selector used to select special occurrences of an element is called contextual selector. A space separates the individual selectors. Only the last element of the pattern is addressed in this kind of selector. For e.g.: TD P TEXT {color: blue}

    View
  • 2.

    What is CSS Box Model and what are its elements?

    Answer:

    This box defines design and layout of elements of CSS. The elements are:

    Margin: the top most layer, the overall structure is shown
    Border: the padding and content option with a border around it is shown.  Background color affects the border.
    Padding: Space is shown. Background colour affects the border.
    Content: Actual content is shown.

    View
  • 3.

    Enlist the various Media types used?

    Answer:

    Different media has different properties as they are case insensitive.

    They are:

    • Aural – for sound synthesizers and speech
    • Print – gives a preview of the content when printed
    • Projection- projects the CSS on projectors.
    • Handheld- uses handheld devices.
    • Screen- computers and laptop screens.
    View
  • 4.

    Can default property value be restored through CSS? If yes, how?

    Answer:

    In CSS, you cannot revert back to old values due to lack of default values. The property can be re- declared to get the default property.

    View
  • 5.

    What happens if 100% width is used along with floats all across the page?

    Answer:

    While making the float declaration, 1 pixel is added every time it is used in the form of the border, and   even more float is allowed thereafter.

    View
  • 6.

    How to overrule underlining Hyperlinks?

    Answer:

    Control statements and external style sheets are used to overrule underlining Hyperlinks.

    E.g:

    B {
     
    text-decoration: none;
     
    }
     
    <B href="career.html" style="text-decoration: none">link text</B>
    View
  • 7.

    What is Pseudo-elements ?

    Answer:

    Pseudo-elements are used to add special effects to some selectors.  CSS in used to apply styles in HTML mark-up. In some cases when extra mark-up or styling is not possible for the document, then there is a feature available in CSS known as pseudo-elements. It will allow extra mark-up to the document without disturbing the actual document.

    View
  • 8.

    Can more than one declaration be added in CSS?

    Answer:

    Yes, it can be achieved by using a semicolon.

    View
  • 9.

    Differentiate Class selector from ID selector?

    Answer:

    While an overall block is given to class selector, ID selector prefers only a single element differing   from other elements.

    View
  • 10.

    What is the usage of Class selector?

    Answer:

    Selectors that are unique to a specific style, are called CLASS selectors. Declaration of style and association with HTML can be made through this. Syntax:

    Classname
    it can be A-Z, a-z or digits.
    .top {font: 14em ;}, class selector
    <Body class= “top”> this class is associated with element </body>

    View
  • 11.

    Why is it easy to insert a file by importing it?

    Answer:

    Importing enables combining external sheets to be inserted in many sheets. Different files and sheets can be used to have different functions. Syntax:

    @import notation, used with <Style> tag.

    View
  • 12.

    Enlist the various fonts’ attributes?

    Answer:

    They are:

    • Font-style
    • Font-variant
    • Font-weight
    • Font-size/line-height
    • Font-family
    • Caption
    • Icon
    View
  • 13.

    Define Declaration block?

    Answer:

    A catalog of directions within braces consisting of property, colon and value is called declaration block.
    e.g.: [property 1: value 3]

    View
  • 14.

    Comment on the Case-sensitivity of CSS ?

    Answer:

    Although, there are no case-sensitivity of CSS, nevertheless font families, URL’s of images, etc is. Only when XML declarations along with XHTML DOCTYPE are being used on the page, CSS is case -sensitive.

    View
  • 15.

    Describe ‘ruleset’?

    Answer:

    Ruleset : Selectors can be attached to other selectors to be identified by ruleset.

    It has two parts:

    • Selector, e.g. R and
    • declaration {text-indent: 11pt}
    View
  • 16.

    Differentiate Style Sheet concept from HTML?

    Answer:

    While HTML provides easy structure method, it lacks styling, unlike Style sheets. Moreover, style sheets have better browser capabilities and formatting options.

    View
  • 17.

    Differentiate logical tags from physical tags?

    Answer:

    • While physical tags are also referred to as presentational mark-up, logical tags are useless for appearances.
    • Physical tags are newer versions while logical tags are old and concentrate on content.
    View
  • 18.

    Enlist the media types CSS allows? 

    Answer:

    The design and customization of documents are rendered by media. By applying media control over the external style sheets, they can be retrieved and used by loading it from the network.

    View
  • 19.

    What does CSS selector mean?

    Answer:

    A string equivalent of HTML elements by which declarations or a set of it, is declared and is a link that can be referred for linking HTML and Style sheet is CSS selector.

    View
  • 20.

    Discuss the merits and demerits of Embedded Style Sheets?

    Answer:

    Merits of Embedded Style Sheets:

    • Multiple tag types can be created in a single document.
    • Styles, in complex situations, can be applied by using Selector and Grouping methods.
    • Extra download is unnecessary.

    Demerits of Embedded Style Sheets:

    • Multiple documents cannot be controlled.
    View

© 2017 QuizBucket.org