CSS basics 1--CSS style sheets and style rules

Source: Internet
Author: User

CSS basics 1--CSS style sheets and style rules

1,CSS (Cascading Style Sheets) Stacked Style Sheets. Used to define the display form of HTMl elements. It is a standard technology developed by W3C to format webpage content.

2,CSSAs one of the technologies that every website designer must master, there are severalAdvantages:

(1) Improve the page browsing speed and save at least 50% of the file size than the traditional text Design Method

(2) Shorten the revision time and reduce maintenance costs

(3) better control of page layout by combining CSS and DIV

(4) Separation of performance, structure, and content

(5) easier search engines

3. CSS style sheets

(1)Embedded style sheet

UseEmbedded Style (2)External style sheet

Create external.CSS file, write the CSS code, and then.Html file links.

Syntax:

(3)Inline style sheet

It is only used for some web page elements, and its function scope is limited to the web page elements that apply it. inline styles are included in HTML tags.

For example, inline Style

4. style rules

(1)Selector: Specifies the element or element that the style rule can act on in the HTML document. In the style rule, the selector is left on the braces.

For example, h1 in h1 {color: orange; background-color: # eea ;}

(2)Declare Block: Section between braces

For example, in h1 {color: orange; background-color: # eea;}, color: orange; background-color: # eea;

(3)Statement:Each statement must use a semicolon (.

For example, color: red in h1 {color: red;} is a declaration.

There can be multiple declarations in a declaration block. Each declaration must be separated by a semicolon.

(4)Attribute

For example, color in h1 {color: red;} is an attribute. Each declaration can have only one attribute.

(5)Note

CSS comments:/* comments */

Shortcut: ctrl + "/"


Related Article

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.