CSS syntax and JSON, JS object difference between the detailed

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.