1 CSS Introduction

Source: Internet
Author: User
Document directory
  • Cascade order
Basic knowledge required

Before continuing to learn, you need to have a basic understanding of the following knowledge:

  • Html
  • XHTML

If you want to learn about these projects, visit the relevant tutorials on the homepage.

CSS Overview
  • CSS refers to a Cascading Style Sheet.
  • CSS is a standard layout language used to control the size, color, and layout of elements.
  • CSS is very precise, powerful, and easy to write.
  • CSS was invented by W3C to replace table-based la S, frameworks, and other non-standard representations.
  • A style defines how to display HTML elements. A style is usually stored in a style sheet, and an external style sheet is stored in a CSS file.
  • External style sheet can greatly improve your work efficiency and greatly save the server bandwidth.
  • The combination of pure CSS layout and XHTML can separate the presentation and structure, make the site easier to maintain, and make it easier to use.
Style solves a common problem

HTML tags are originally designed to define document content. By using tags such as

Because the two major browsers (Netscape and Internet Explorer) constantly add new HTML tags and attributes (such as font tags and color attributes) to the HTML specification, therefore, it is increasingly difficult to create sites whose content is clearly independent from the document presentation layer.

To solve this problem, the W3C, a non-profit standardization alliance, shouldered the mission of HTML standardization and created styles outside HTML 4.0 ).

All mainstream browsers support Cascading Style Sheets.

Style Sheets greatly improve work efficiency

A style sheet defines how HTML elements are displayed. For example, the style labels and colors in HTML 3.2are usually stored in external. CSS files. By editing only a simple CSS document, the external style sheet enables you to change the appearance of all the page la s on the site at the same time.

As multiple page styles and la s can be controlled at the same time, CSS can be a breakthrough in the web design field. As a website developer, you can define a style for each HTML element and apply it to any number of pages you want. To perform global transformation, you only need to change the style, and all elements in the website will be automatically upgraded.

Multiple styles are stacked into one

The style sheet allows the style information to be specified in multiple ways. Styles can be specified in a single HTML element, in the header element of an HTML page, or in an external CSS file. Even multiple external style sheets can be referenced within a single HTML document.

Cascade order

Which style will be used when the same HTML element is defined by more than one style?

Generally, all styles are stacked in a new virtual style table according to the following rules, where number 4 has the highest priority.

  1. Browser default settings
  2. External style sheet
  3. Internal style sheet (inside the
  4. Inline style (inside the HTML element)

Therefore, inline styles (inside an HTML element) have the highest priority, which means they take precedence over the following style Declaration:

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.