CSS Tips
- How to increase spacing between lines
- How to right-align text in a text field
- Highlight text-box background color
Increase space between lines
Use the line-height property to set the height between lines. Example:line-height:16pt
More information can be found on the TopXml site.
How to right-align text in a text field
Very often you need to right-align text in a text-box, mostly for financial calculations.
One of the solutions proposed was to use table cell padding, i.e. to add empty spaces before a number. Naturally, you need to calculate the length of the number string and make heavy use of javascript. Is there a simpler solution?
The answer is yes. The right solution is to use the Cascading Style Sheets (CSS).
Use the following class selector:
.tar {text-align:right}
The selector name is arbitrary, of course, whereas the contents of the braces are not. Then, within the html input tag use the following:
class=tar
.That's all it takes.
Highlight text-box background color
OnMouseOver ="this.style.background ='blue'";OnMouseOut = "this.style.background=''";
Unfortunately, if no stylesheets are used for the input tag, on Windows XP, the above would change the text-box appearance. The following INPUT style will help to eliminate this problem:
INPUT{ BORDER-RIGHT: 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: 1px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: 1px solid; PADDING-TOP: 1px; BORDER-BOTTOM: 1px solid }