cfUniForm - Right-Aligned Labels and No Asterisk
Posted on February 17, 2010 at 9:16 PM in General, Uni-Form Tag Library
I sometimes get asked questions like "hey, man, how can I right-align labels with cfUniForm?" or "how can I change colors?", etc. The answer is: override the CSS! That's the entire purpose of Cascading Style Sheets. Here's a quick example of how to override a couple of default behaviors with the Uni-Form specification (which is what cfUniForm is a wrapper for).
Right-Aligned Labels
The Uni-Form spec default has <label> tags left-aligned. However, some people prefer their forms to have the text labels right-aligned, or "next to" their respective entry fields. Making this happen is incredibly simple. Just add the following to your application's stylesheet:
- div.ctrlHolder > label,p.label { text-align: right; }
- .uniForm .inlineLabels label em, .uniForm .inlineLabels .label em { position: relative !important; right: auto !important; display: inline !important; }
Ditch the Asterisk(*)
The Uni-Form spec includes an <em>*</em> in the label on required form fields. Want it gone? CSS to the rescue once again.
- .uniForm .inlineLabels label em, .uniForm .inlineLabels .label em { display: none !important; }
Easy.
Summary
CSS is your friend. :-)
Latest Articles
- No recent entries.
Categories
- ColdBox (21) [RSS]
- ColdFusion (92) [RSS]
- Fusebox (3) [RSS]
- General (22) [RSS]
- jQuery (15) [RSS]
- Kalendar (1) [RSS]
- Linux (1) [RSS]
- Mura CMS (1) [RSS]
- Railo (1) [RSS]
- Rants (5) [RSS]
- Transfer (8) [RSS]
- Uni-Form Tag Library (36) [RSS]
Quick Links
Blogs I Read
Calendar
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
« Aug | ||||||
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Subscribe
Enter a valid email address.
On 2/18/10 at 11:58 AM, Jeremy Prevost said: