CSS Interview Important Questions

pvpen

CSS Interview Questions

Q 1) What is CSS?

CSS outline the style of an HTML webpage, it is a language by which we can set the behavior of an HTML webpage. It describes how the HTML content will be shown on screen.

CSS controls the layout of several HTML web pages. CSS is referred to as the Cascading Style Sheet.


Q 2) Name all the modules which are used in the current version of CSS.

  • Selectors
  • Box Model
  • Backgrounds and Borders
  • Text Effects
  • 2D/3D Transformations
  • Animations
  • Multiple Column Layout
  • User Interface.

Q 3) What are the limitations of CSS ?

  • Ascending by selectors is not possible
  • Limitations of vertical control
  • No expressions
  • No column declaration
  • Pseudo-class not controlled by dynamic behavior
  • Rules, styles, targeting specific text not possible

Q 4) Who maintains the CSS specifications?

World Wide Web Consortium maintains the CSS specifications.


Q 5) Differentiate Style Sheet concept from HTML?

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


Q 6) Describe ‘ruleset’?

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


Q 7) Explain type selector in CSS?

Type selector matches the element of specific type. To give the color for all inputs with text types, we can do like this.

 input[type="text"]{
  color: #b2bfc7;
 }


Q 8) Explain universal selector in CSS?

Universal selectors is used to match any element types. Below is the example for the same. For example,

									
 * { 
  color: #FFFFFF; 
 }

This rule is used to render the content of all elements in our document in white.


Q 9) Explain descendant selector in CSS?

Descendant selectors are used when any style to be applied to an element when the element lies inside some element. For example,

 ul em {
  color: #FFFFFF; 
 }

As shown above style applied to element – “<em>” when it lies inside “<li>”.


Q 10) Explain id selector in CSS?

Id selector is used to apply the style to an element based on the “id” of an element. For example,

 #elementId {
  color: #FFFFFF; 
 }

In the above code snippet all the elements having id – “elementId” will have the color white.


Q 11) What is Pseudo-elements ?

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.


Q 12) How to overrule underlining Hyperlinks?

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

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

Q 13) What is contextual selector?

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}


Q 14) How does Z index function?

Overlapping may occur while using CSS for positioning HTML elements. Z index helps in specifying the overlapping element. It is a number which can be positive or negative, the default value being zero.


Q 15) What is graceful degradation?

In case the component fails, it will continue to work properly in the presence of a graceful degradation. The latest browser application is used when a webpage is designed.


Q 16) How does Z index function?

Overlapping may occur while using CSS for positioning HTML elements. Z index helps in specifying the overlapping element. It is a number which can be positive or negative, the default value being zero.


Q 17) Why is @import only at the top?

@import is preferred only at the top, to avoid any overriding rules. Generally, ranking order is followed in most programming languages such as Java, Modula, etc. In C, the # is a prominent example of a @import being at the top.


Q 18) What is Alternate Style Sheet?

Alternate Style Sheets allows the user to select the style in which the page is displayed using the view>page style menu. Through Alternate Style Sheet, user can see a multiple version of the page on their needs and preferences.


Q 19) Explain the concept of Tweening.

Tweening is the process in which we create intermediate frames between two images to get the appearance of the first image which develops into the second image.


Q 20) Explain the term Responsive web design.

It is a method in which we design and develop a web page according to the user activities and conditions which are based on various components like the size of the screen, portability of the web page on different device etc.

pvpen