Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Tuesday, December 22, 2015

What's the difference between CSS inherit and initial?

What's the difference between CSS inherit and initial?


What exactly is the difference between inherit and initial in terms of CSS? For me they always worked the same, for example:

a.no-style{color: inherit}  

will do the same as

a.no-style{color: initial}  

Answer by vishnu for What's the difference between CSS inherit and initial?


inherit

This keyword applies the value of the element?s parent,

whether that makes sense or not. Some CSS properties, such as color or font-family, are automatically inherited, but others, such as display or margin, aren?t. The inherit keyword should work on all CSS properties, though.

initial

This keyword applies the initial value as defined in the CSS specifications. Sometimes this initial value makes sense (float: none), sometimes it?s there for historical reasons (background-repeat: repeat), and sometimes the spec writers made an essentially random-though-somewhat-defensible choice (color: black).

More from Quirksmode site

Answer by Muhammad Khair for What's the difference between CSS inherit and initial?


inherit :

The inherit keyword specifies that a property should inherit its value from its parent element.

example

initial :

The initial keyword is used to set a CSS property to its default value.

example

Answer by Joshua for What's the difference between CSS inherit and initial?


Inheritance is always from the parent element in the document tree, even when the parent element is not the containing block. The initial tag just gives the element its original value.

Answer by Ali Adravi for What's the difference between CSS inherit and initial?


The initial value given in the summary of the definition of each CSS property has different meaning for inherited and non-inherited properties.

For inherited properties, the initial value is used, for the root element only, when no value is specified for the element.

For non-inherited properties the initial value is used, for any element, when no value is specified for the element.

An initial keyword is being added in CSS3 to allow authors to explicitly specify this initial value.

The inherit keyword means use whatever value is assigned to my parent.

Answer by user3026899 for What's the difference between CSS inherit and initial?


initial is not supported by explorer.


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.