Created
February 12, 2014 22:28
-
-
Save dmccreary/8965831 to your computer and use it in GitHub Desktop.
XForms CSS for right alignment of decimal values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xxf="http://orbeon.org/oxf/xml/xforms"> | |
| <head> | |
| <title>XForms Label Layout Styles</title> | |
| <xf:model> | |
| <xf:instance xmlns=""> | |
| <data> | |
| <inputs> | |
| <amount1>123</amount1> | |
| <amount2>456</amount2> | |
| <amount3>789</amount3> | |
| </inputs> | |
| <sum></sum> | |
| </data> | |
| </xf:instance> | |
| <xf:bind id="decimal" ref="inputs/*, sum" type="xf:decimal"/> | |
| <xf:bind id="sum" ref="sum" calculate="sum( ../inputs/*[string() castable as xs:decimal], 0)"/> | |
| </xf:model> | |
| <style type="text/css"> | |
| .orbeon .form {background-color:linen; margin:5px; padding: 5px; border: solid gray 1px;} | |
| /* make control labels bold */ | |
| .orbeon .xforms-control .xforms-label {font-weight: bold;} | |
| /* make controls be their own blocks */ | |
| .orbeon .label-right .xforms-control {display:block;line-height:35px;} | |
| /* used to control the width of the label areas to the left of the controls */ | |
| .orbeon .label-right .xforms-control .xforms-label {display:inline-block; width: 12ex; margin-right: 1ex;} | |
| /* used to control the width of all input fields */ | |
| .orbeon .label-right .xforms-control .xforms-input-input, .orbeon .label-right .xforms-control .xforms-input-input {width: 15ex;} | |
| .orbeon .label-right .xforms-control .xforms-label {text-align:right;} | |
| .orbeon .xforms-control.xforms-type-decimal .xforms-input-input {text-align: right;} | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container span12"> | |
| <div class="form span3 label-right"> | |
| <xf:input ref="inputs/amount1"> | |
| <xf:label>Amount 1</xf:label> | |
| </xf:input> | |
| <xf:input ref="inputs/amount2"> | |
| <xf:label>Amount 2</xf:label> | |
| </xf:input> | |
| <xf:input ref="inputs/amount3"> | |
| <xf:label>Amount 3</xf:label> | |
| </xf:input> | |
| <xf:input ref="sum"> | |
| <xf:label>Total</xf:label> | |
| </xf:input> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment