Extreme Programming

EXtreme Programming Methodology is The Most Effective Methodology in Software Development

The world of computers is amazing, and unless you are a person who is willing to go through to be thrown into parts of the world of computers, which does not feel amazing, then you will never be...

cyber security

Computer Forensics has Revolutionized the Justice Systems of The World

As our current world becomes more and more intertwined with technology, criminal activities are happening in the cyber world, and there must be a science to stop these crimes.

In today’s...

scrum methodology

The Scrum Methodology is A Framework that Helps The Development Life Cycle of Any Prodcut

In a scrum methodology, all the developers have to be committed to the project, and this may not be the case, because someone may just want to quit, or they may get fired.

In today’s...

agile methodology

The Exploration of The Agile Methodology In Large Projects

The computer world, is very interesting and people are catching up to it, when they want to develop software, because they are following techniques, which are useful for them to accomplish their...

agile environment

The Agile Methodology has Revolutionized The Information Technology World

The design and build activities for engineering, information technology, and a new product or service development projects, can be managed through the agile development methodology.


Error message

Notice: Undefined variable: front_page in eval() (line 19 of /home/content/93/10477193/html/modules/php/php.module(80) : eval()'d code).

Mastering Cascading Style Sheet - Structuring Your Code - Cascade and Specificity

css3 cascade and specificity

The power of the online world, is very influential in our world today, and many of us, let the cyber world, to influence, our world; because many of the events, which are occurring on the earth, are definitely happening on the Internet first and then they come into fruition in real life.

The events, I speak of, do have to become viral online, but once these events, gain enough traction, we see them manifested, somewhere on the planet.

In today’s article, we are going to continue our conversation on CSS3, in specifically the cascade and specificity of cascade style sheets.

It is likely that two or more rules, will target the same element, even with a moderately complicated stylesheet.

The cascade, is a process which is used, to handle issues and conflicts, which wouldn’t allow two or more rules, which would target the same element.

Each rule is assigned an importance, with the cascade process.

The least important rule in CSS is the default style sheet, which is used, by your browser or user agent.

The second most important, behind the most important rule is the user style sheet rules, and the most important considered rule is the author stylesheet set of rules.

A rule specified as !important, give users more control over rules, and over-ride them, even a rules flagged as !important by the author.

The following order of importance, is used with the cascade process, User styles flagged as !important, Author styles flagged as !important, Author styles, User styles and finally Styles applied by the browser/user agent.

The specificity of the selector is used, in order to order Rules; also Rules with more specific selectors, override those, with less specific ones.

The last rule defined, takes precedence, when two rules, are equally specific.

Alright now let’s talk a bit about specificity, in order to calculate how specific a rule is, a numeric value, is assigned to each type of a selector.

When the value of each of the selectors, are added up, then the specificity of a rule, is then calculated.

In order to ensure, that a highly specific selector, such as an ID is not overridden, by lots of less specific selectors, such as type selectors, specificity is not calculated in base 10 but a high unspecified base number.

Designers can calculate specificity in base 10 for simplicity’s sake, if they have fewer than 10 selectors in a specific selector.

Four constituent levels, such as a, b, c, and d are used to break down the specificity of a selector.

When the style is an inline style, than a = 1; b = the total number of ID selectors, c = the number of class, pseudo-class, and attribute selectors; and d = the number of type selectors and pseudo-element selectors.

The specificity of any selector can be calculated using these rules.

A rule written in a style attribute will essentially, be more specific than any other rule.

A rule without an ID will be less specific than, a rule, which has an ID; and a rule with a class selector will be more specific than a rule, with just type selector.

If two rules have the same specificity finally then the last one prevails.

Thank you for reading this article!!!