So you have some nice rounded corners in your design and your client decides that they aren't round enough. Now you have to tediously edit each border-radius property and all the browser specific prefixed ones as well. Here's how to use a User Defined Tag to fix that.
As you know, there are some useful CSS3 properties that require that the css property be written with a vendor specific prefix, but the value is usually the same for each browser. There are tools like border-radius.com that can help in some situations.
This is a good tool, when you are first creating your styles, but what if you need to change the values in the future? Wouldn't it be nice if we could change the value in only one place? With CMS Made Simple we can write a UDT that will do just that.
Here is a list of the prefixes that I know about:
|-webkit-||Safari (and other WebKit-based browsers)|
|-moz-||Mozilla Foundation (Gecko-based browsers)|
|-atsc-||Advanced Television Standards Committee|
|-wap-||The WAP Forum|
Create a UDT. Lets call it css_prefixs.
This code expects to receive val=” “ and property=” “ parameters and uses them to generate the prefixes you need.
In your CSS you will use it like so:
[[css_prefixs property='border-radius' val='50px']]
Note that in CSS we don't use curly braces for smarty tags.
This will output the following:
But it can be used for more than just border-radius, the following uses the same UDT to produce the css for using the border-image property:
[[css_prefixs property='border-image' val='url("border-shadow.png") 0 91 0 92 stretch']]
In some situations it might be helpful to write a specialized UDT for properties that are formatted differently for different browser vendors. I will leave it up to you to expand on this concept.