css| Page | style sheet
Need to have the basic knowledge
Before continuing your study, you need to have a basic understanding of the following knowledge:
If you want to first learn these items, please visit the relevant tutorials at this site.
-
CSS Overview
-
- CSS refers to cascading style sheets (cascading style Sheets), cascading meaning that multiple style definitions are stacked into one.
- CSS is the standard layout language used to control the size, color, and layout of elements.
- CSS is very precise, powerful and easy to write.
- CSS is invented by the consortium to replace tabular layouts, frameworks, and other non-standard performance methods.
- Styles (style) define how HTML elements are displayed; Styles are usually stored in style sheets; external style sheets are stored in CSS files.
- An external style sheet (External style Sheets) can greatly increase your productivity and greatly conserve server bandwidth.
- The combination of pure CSS layout and XHTML enables separation of performance from structure and makes the site easier to maintain and more user-friendly.
CSS Demo
By using the css,html document, it will be displayed in different output styles.
The style solves a common problem
HTML tags were originally designed to define document content. By using tags such as
Because two major browsers (Netscape and Internet Explorer) constantly add new HTML tags and attributes, such as font labels and color properties, to the HTML specification, it becomes increasingly difficult to create sites that are clearly independent of the document presentation layer.
To address this problem, the World Wide Web Consortium (WWW), the nonprofit Standardization Consortium, has a mission to standardize HTML and create styles (styling) outside of HTML 4.0.
Cascading style sheets are supported in all major browsers.
The style sheet greatly improves productivity
Style sheets define how HTML elements are displayed, and font labels and color attributes in styles such as HTML 3.2 are usually saved in an external. css file. By simply editing a simple CSS document, an external style sheet gives you the ability to change the appearance of all page layouts in the site at the same time.
Because it allows you to control the style and layout of multiple pages at the same time, CSS can be called a breakthrough in the field of web design. As a web developer, you can define styles for each HTML element and apply it to any number of pages you want. For global transformations, simply change the style, and all elements in the site are automatically upgraded.
Multiple styles will cascade into one
Style sheets allow style information to be specified in a variety of 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
When the same HTML element is defined by more than one style, which style is used?
In general, all styles are stacked in a new virtual stylesheet based on the following rules, where the number 4 has the highest precedence.
- Browser default settings
- External style sheet
- Internal style sheet (located inside
- Inline style (inside HTML element)
Therefore, inline styles (inside HTML elements) have the highest precedence, which means that it will take precedence over the style declarations in the: