FCF 2.0 development in progress...
> > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

fcf.styleToString() function

string fcf.styleToString(string a_name, a_mixed a_value)
string fcf.styleToString({name: value} a_descriptions)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Converts the a_name and a_value parameters to a string of the format `a_name : a_value`. For dimension values, automatically adds the ending "px";

Arguments

string a_name
- Style name

mixed a_value
- Style value

{a_name: a_value} a_descriptions
- Object with properties description
Result
string
- A string containing CSS properties and values

Example: Function application

{ let result = fcf.styleToString("color", "#aaa"); console.log(result); } { let result = fcf.styleToString("width", 10); console.log(result); } { let result = fcf.styleToString({"width": 10, "color": "#aaa"}); console.log(result); }

Output:

color: #aaa width: 10px width: 10px; color: #aaa