Home > Backend Development > PHP Problem > How to call css in php

How to call css in php

青灯夜游
Release: 2023-03-09 18:14:02
Original
5598 people have browsed it

Method: First write the css style code in a ".css" file; then in the PHP file, use "echo '';" statement can be called.

How to call css in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

PHP scripts can also call css styles Yes, we can use the echo statement to call the CSS style

First write the css style code in a ".css" file, such as theme.css; then use the following statement to call it

<?php
echo ‘<link rel=\"stylesheet\" type=\"text/css\" href=\"theme.css\" />&#39;;
?>
Copy after login

Benefits of calling css style sheets from outside the php page:

  • The web page processing speed will be faster, especially when there are many web pages sharing a CSS style sheet. ! Because you don’t have to write the same CSS code for every page, the web page will naturally be slimmer and lighter.

  • It can prevent some users with low computer skills from directly seeing CSS syntax (that is, some people don’t like to be seen). Of course, it means that they cannot see it directly, not that they cannot see it. As you can see, with a little bit of skill, it’s really easy to view the content of a CSS file.

  • Of course it is easy to maintain! As long as you modify one CSS file, no matter if you have thousands of web page files, your latest modified version will prevail!

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to call css in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template