The JSON object is a subclass of the JS object, and the CSS object is a subclass of JSON, that is, the CSS inherits the JS object. This article mainly give you a detailed introduction of CSS syntax and JSON, JS object difference comparison, interested friends to see together, hope to help everyone.
CSS (cascading Style Sheets) rules are composed of 2 parts: selectors, declarations.
Selector{declaration1;declaration2;declaration3;...declarationn}
Declaration are separated by semicolons (;) and are expressed as property:value1 value2. is a single layer of non-nested structure.
Value is a specific value such as the size of the PX, the color of the #ffffff,position relative/absolute, and so on
Selector can be represented by multiple selectors separated by commas such as H1,H2,H3,H4.
Note: Code CSS should be noted when the value of the property is ordered or not
backgroud: color position size repeat attachment url("img.url")This type of property browser renders parsing by using the regular judgment value of the types can be modified to modify the specified properties, the order and the value type can be arbitrarily paired.
Padding:left top Right bottom this type of property rendering is parsed according to order, to modify the specified property to complete its preceding value.
JSON (Javascript object nonation) is composed of object declarations.
{Declaration1,declaration2,.. Declarationn}
Its representation can be a tree-like hierarchical nested structure, where an object's properties can be represented by another or more objects. The outer layer of multiple objects is closed by the JS array [] symbol, the object is closed by the set symbol {}, and the mapping relationship is represented by a colon.
JS Object
Consists of the set symbol {}, which is a property: value separated by commas, and the structure and JSON objects are similar to nested, but whose properties are not to be enclosed in quotation marks.
It can be concluded that the JSON object is a subclass of the JS object, and the CSS object is a subclass of JSON, that is, CSS inherits the JS object.