Home >Backend Development >PHP Problem >What is the relationship between php and css
What is the connection between php and css?
CSS is used to make the presentation layer of web pages, and provides pixel-level precise control over the layout of elements in web pages, such as fonts, pictures, etc.
php is used to process logic layer, that is, what functions do you want the web page to provide and what actions do you want it to complete? Such as querying data, calculating interest, generating charts, etc. The php code is embedded in the html.
CSS
Cascading Style Sheets (English full name: Cascading Style Sheets) is an application used to express HTML (Standard Universal Markup Language) or XML (Standard Common Markup Language) A subset of Universal Markup Language) and other document-style computer languages. CSS can not only statically modify web pages, but can also cooperate with various scripting languages to dynamically format various elements of web pages.
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.
Language Features
CSS provides a style description for the HTML markup language and defines how elements are displayed. CSS is a breakthrough in the field of web design. It can be used to modify a small style to update all page elements related to it.
In general, CSS has the following characteristics:
Rich style definition
CSS provides a rich document style appearance, as well as setting text and The ability of the background attribute; 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, you can also define it in the header part of the HTML document, or you can declare the style 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 of this is that a large number of HTML tags, thereby increasing the page file size. 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.
PHP
Foreign name: PHP: Hypertext Preprocessor, Chinese name: "Hypertext Preprocessor", is a general open source scripting language. The syntax absorbs the characteristics of C language, Java and Perl, which is easy to learn and widely used. It is mainly suitable for the field of Web development. PHP's unique syntax mixes C, Java, Perl, and PHP's own syntax. It can execute dynamic web pages faster than CGI or Perl. Compared with other programming languages, dynamic pages made with PHP embed programs into HTML (an application under the Standard Universal Markup Language) document for execution, and the execution efficiency is much higher than CGI that completely generates HTML tags; PHP can also execute compiled code. Compilation can achieve encryption and optimize code running, making the code run faster.
The features of PHP include:
1. PHP’s unique syntax mixes C, Java, Perl and PHP’s own innovative syntax.
2. PHP can execute dynamic web pages faster than CGI or Perl - in terms of dynamic pages, compared with other programming languages,
PHP embeds programs into HTML documents. The execution and execution efficiency are much higher than CGI that completely generates HTML tags;
PHP has very powerful functions, and all CGI functions can be realized by PHP.
3. PHP supports almost all popular databases and operating systems.
4. The most important thing is that PHP can be extended with C and C!
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of What is the relationship between php and css. For more information, please follow other related articles on the PHP Chinese website!