CSS3 has many useful new attributes, such as rounded corners, shadows, and animations. However, these attributes are supported by private tags such as-moz-and-webkit-in different browsers. Therefore, when cross-browser implementation is required, an attribute must be written several times. Example: {code ...} there is... CSS3 has many useful new attributes, such as rounded corners, shadows, and animations. However, these attributes are supported by private tags such as-moz-and-webkit-in different browsers. Therefore, when cross-browser implementation is required, an attribute must be written several times. For example:
-webkit-box-shadow: 20px;-moz-box-shadow: 20px;box-shadow: 20px;
There is a good site (http://prefixr.com/) that can help generate these code. However, this is non-real-time generation and must be manually added to your own files. Therefore, modifications are cumbersome.
Is there a php implementation that only writes standard attributes in css, such
/* test.css */p{ box-shadow: 20px;}
After the css file is read through php and automatically identified, the following code is output in Real Time:
/* test.php?file=test.css */p{-webkit-box-shadow: 20px;-moz-box-shadow: 20px;box-shadow: 20px;}
In this way, css compilation, debugging, and modification become quite fast and can quickly generate publishing files. In the future, when the browser supports changes, you only need to modify the corresponding rules and then generate a file.
The trouble now is the complexity of CSS attributes, refer to the examples on the http://prefixr.com/Home Page involves most of them.
How does one implement automatic matching and addition through regular expressions?
Or are there any general implementation ideas?
Reply content:
CSS3 has many useful new attributes, such as rounded corners, shadows, and animations. However, these attributes are supported by private tags such as-moz-and-webkit-in different browsers. Therefore, when cross-browser implementation is required, an attribute must be written several times. For example:
-webkit-box-shadow: 20px;-moz-box-shadow: 20px;box-shadow: 20px;
There is a good site (http://prefixr.com/) that can help generate these code. However, this is non-real-time generation and must be manually added to your own files. Therefore, modifications are cumbersome.
Is there a php implementation that only writes standard attributes in css, such
/* test.css */p{ box-shadow: 20px;}
After the css file is read through php and automatically identified, the following code is output in Real Time:
/* test.php?file=test.css */p{-webkit-box-shadow: 20px;-moz-box-shadow: 20px;box-shadow: 20px;}
In this way, css compilation, debugging, and modification become quite fast and can quickly generate publishing files. In the future, when the browser supports changes, you only need to modify the corresponding rules and then generate a file.
The trouble now is the complexity of CSS attributes, refer to the examples on the http://prefixr.com/Home Page involves most of them.
How does one implement automatic matching and addition through regular expressions?
Or are there any general implementation ideas?
PHP implementation is not very clear, but there is a LESS javascript implementation. during compilation, special js files are called for fast debugging, and CSS files can be directly output during deployment.
This function should be generated by IDE, and phpstrome can complete this requirement through the plug-in.
RecommendedlessAnd other pre-processing tools;
You can try: