What is meant by cascading of styles?

Cascading of styles is one in which an element called as child element placed with another element called as parent element inherit the styles of the parent. Cascading of styles also comes into picture when there is an overlap of styles defined. That is in other words usually among the three styles namely embedded style, external style and inline style. The general method of execution is to check for the external style by checking for the tag. If it is found it gets placed in memory and gets executed. Otherswise the next choice is to check for embedded styles and then only the inline styles gets executed. But in all situations proper flow may not occur. There may b scenarios in which these type definitions gets overlapped. In such situations cascading takes places by which the style which is nearest to the content gets executed. There may be also scenarios in which conflict can occur among styles of same type. In such a situation the rule whichever occurs last takes the winning step to be applied.

Questions by GeekAdmin   answers by GeekAdmin

Showing Answers 1 - 1 of 1 Answers

Rachana88

  • Sep 7th, 2010
 

Styles can be specified:

  • inside an HTML element( Inline style)
  • inside the head section of an HTML page(internal style sheet)
  • in an external CSS file(external style sheet)

When more than one style is specified for an HTML document , Cascading order determines the style to be used.

Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:

  1. Browser default
  2. External style sheet
  3. Internal style sheet (in the head section)
  4. Inline style (inside an HTML element)

So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the <head> tag, or in an external style sheet, or in a browser (a default value)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions