Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




Recent Comments

Powered by Disqus




Back to articles

Automatically add CSS vendor prefixes

CSSfix class an automatically apply vendor prefixes to specified CSS rules.

It also applies other fixes, for different CSS browser specifics.

Contents

Download

Example codes

//declaring class instance
include("./CSSfix.php");
$css = new CSSfix();

$css->from_file("./style.css");

echo $css->generate(false);

Examples in action

Example scripts provided with package in action:

Method list

Set prefixes

Back to method list

Method nameset_prefixes($prefixes)
Descriptionprovide array of prefixes, that should be applied, by default there are five prefixes applied to certain css properties
Input parameters

array $prefixes - array with supported vendor prefixes (default: array("moz", "webkit", "o", "ms", "khtml"))

Example inputset_prefixes(array("moz", "webkit", "o"))

Get prefixes

Back to method list

Method nameget_prefixes()
DescriptionGet array of defined prefixes

Get properties

Back to method list

Method nameget_properties()
DescriptionGet array of properties, that can be changed

Ignore properties

Back to method list

Method nameset_ignore($properties)
Description

Provide array of css properties, that should be ignored and vendor prefixes won't be applied

Input parameters

array $properties - array with css properties to ignore

Example inputset_prefixes(array("border-radius", "opacity", "@keyframes"))

Add CSS from file

Back to method list

Method namefrom_file($css_file)
Description

Read css rules from file. After it will be possible to apply vendor prefixes to these CSS rules

Input parameters

string $css_file - path to css file

Example inputfrom_file("./styles/style.css")

Add CSS from string

Back to method list

Method namefrom_string($css_rules)
Description

Add css rules from string. After it will be possible to apply vendor prefixes to these CSS rules

Input parameters

string $css_rules - string with css rules

Example inputfrom_string("div{border-radius: 10px;opacity: 0.5;}")

Get modified CSS

Back to method list

Method namegenerate($min = true)
Description

Generate new CSS rules with applied vendor prefixes

Input parameters

bool $min - should css be minimized

Example inputgenerate(false)

Save modified CSS to file

Back to method list

Method nameto_file($file, $min = true)
Description

Generate new CSS rules with applied vendor prefixes and save it to file

Input parameters

string $file - path to file, which should be created

bool $min - should css be minimized

Example inputto_file("./styles/mod_styles.css", false)

Awards

CSS Fix class was nominated to Innovation Award please support it by voting :)

Latest changes

None for now

Support

PHP classes support forum or comments below


You may also be interested in:

Powered by BlogAlike.com

blog comments powered by Disqus