Each property in the CSS has a specific value of "inherit", which means that the corresponding property of the parent element is specified, using inherit on the one hand to indicate the style attributes to inherit from the parent element on the one hand, and the child element to inherit the attributes that are not automatically inherited.
Other words:
Inherit is a property that inherits from the parent class, typically used for fonts, colors, and so on, auto is adaptive, generally used for height, width, margin, and padding, etc. about length properties
If the designer wants the div element of class box to have a 2px black border, and has a 5px fill, and wants its sub-div element to have the same style,
You can write the following rules:
<!DOCTYPE HTML><HTML><Head> <MetaCharSet= "Utf-8"> <title>JS Bin</title> <style> /*enables child elements to inherit attributes that are not automatically inherited*/. Box{Border:2px solid Black;padding:5px;background:#ccc;Height:100px; }. Box Div{ /*use inherit to inherit attributes from parent, unlike auto*/Border:Inherit;padding:Inherit;Height:Auto; } </style></Head><Body> <Divclass= ' box '>dad<Div>Son</Div> </Div></Body></HTML>
On-line debugging: Inherit and Auto differences
Http://jsbin.com/fuwiyo/3/edit?html,output
Inherit in CSS specifies the difference between the use of inheritance and auto