CSS is mainly used to design the style of web pages and beautify web pages; it can not only statically modify web pages, but also dynamically format various elements of web pages in conjunction with various scripting languages. CSS can perform pixel-level precise control over the layout of element positions in web pages, supports almost all font size styles, and has the ability to edit web page object and model styles.
The operating environment of this tutorial: Windows 7 system, CSS3 version, Dell G3 computer.
CSS (Cascading Style Sheets), it is a computer language used to express file styles such as HTML or XML. It is a programming language used to express html styles. It can be done A style language that separates web pages and content.
Before CSS, almost all presentation properties of an HTML document were contained in HTML markup (especially in HTML tags); all font colors, background styles, element alignment, borders, and sizes had to be in HTML explicit description.
As a result, the development of large websites becomes a long and expensive process as style information is added repeatedly to every page of the website.
In order to solve this problem, the World Wide Web Consortium (W3C) introduced CSS in 1996 and maintained its standards. CSS aims to achieve separation of presentation and content. Web designers can now move a web page's formatting information into a separate style sheet, which makes HTML markup simpler and more maintainable.
What can css do
CSS is mainly used to design the style of web pages and beautify web pages; it can not only statically modify web pages, but also dynamically cooperate with various script languages Format each element of the web page.
CSS can perform pixel-level precise control over the layout of element positions in web pages, supports almost all font size styles, and has the ability to edit web page objects and model styles.
Using CSS technology when making the homepage can effectively achieve more precise control over the layout, fonts, colors, backgrounds and other effects of the page.
As long as you make some simple modifications to the corresponding code, you can change the appearance and format of different parts of the same page, or web pages with different numbers of pages.
CSS has the following characteristics:
Rich style definition
CSS provides a rich set of document style appearances, as well as settings The ability of text and background attributes; allows you to create a border for any element, as well as the distance between the element border and other elements, and the distance between the element border and the element content; allows you to freely change the capitalization, decoration, and other page effects of text.
Easy to use and modify
CSS can define the style in the style attribute of the HTML element, or in the header part of the HTML document, or in the Styles are declared in a special CSS file for reference in HTML pages. In short, CSS style sheets can store and manage all style declarations in a unified manner.
In addition, elements of the same style can be classified and defined using the same style, you can also apply a certain style to all HTML tags with the same name, or you can assign a CSS style to a certain in page elements. If we want to modify the style, we only need to find the corresponding style statement in the style list and modify it.
Multi-page application
CSS style sheet can be stored in a separate CSS file, so that we can use the same CSS style sheet in multiple pages. Theoretically, CSS style sheets do not belong to any page file and can be referenced in any page file. In this way, the styles of multiple pages can be unified.
Cascading
Simply put, cascading is to set the same style multiple times on an element, which will use the last attribute value set. For example, if you use the same set of CSS style sheets for multiple pages in a site, and if you want to use other styles for some elements in some pages, you can define a separate style sheet for these styles and apply them to the page. These styles defined later will override the previous style settings, and what you see in the browser will be the style effect set last.
Page compression
In websites that use HTML to define page effects, a large number or repeated tables and font elements are often required to form text styles of various specifications. The consequence is that a large number of HTML tags will be generated, thereby increasing the size of the page file. Putting the style declaration separately in the CSS style sheet can greatly reduce the size of the page, so the time spent loading the page will also be greatly reduced. In addition, the reuse of CSS style sheets reduces the size of the page to a greater extent and reduces the download time.
(Learning video sharing: css video tutorial)
The above is the detailed content of what css can do. For more information, please follow other related articles on the PHP Chinese website!