海边 - 页面格式

时间:2013-07-17 02:32:53

标签: html css smalltalk seaside

我们的页面呈现的内容如下: enter image description here

有没有办法可以更好地格式化这个?例如,可能在一列中有标签而在另一列中有输入吗?

以下是我们代码的片段:

renderContentOn: html

    html horizontalRule.
    html horizontalRule.
    html heading level: 2; with: 'System Warnings & Errors:'.
    html horizontalRule.
    (SpendingManager warningsFound = false) ifFalse: [ 
        self renderWarnings.
        WarningsReport renderContentOn: html.
        SpendingManager clearProblemList.

    html horizontalRule.
    html horizontalRule.
    ].

        html heading level: 2; with: 'Create A Fund:'.
            html form: [
            html label: 'Code:  '.
            html textInput
            on: #fName of: FundCreator.
                html break.
            html label: '   Starting Amount:  '.
            html textInput
            on: #amount of: FundCreator.
                html break.

        html submitButton
            callback: [(FundCreator fName = '') ifFalse: [FundCreator createFromUI.] 
                                                ifTrue: [SpendingManager addProblem: 'SP0002']. 
            self renderReport ];
            text: 'Create Fund'.
        ].

        html heading level: 2; with: 'Create A GLAC:'.
        html form: [

            html label: 'Code:  '.
            html textInput
            on: #gName of: GLACCreator.
                html break.

            html label: '   Debit Fund:  '.
            html textInput
            on: #dFund of: GLACCreator.
                html break.

            html label: '   Credit Fund:  '.
            html textInput
            on: #cFund of: GLACCreator.
                html break.

            html label: '   Description:  '.
            html textInput
            on: #descr of: GLACCreator.
                html break.

        html submitButton
            callback: [GLACCreator createFromUI. self renderReport ];
            text: 'Create GLAC'.

    ].

        html heading level: 2; with: 'Create a Transaction:'.
        html form: [

            html label: 'GLAC:  '.
            html textInput
            on: #aGLAC of: TransactionCreator.
                html break.

            html label: '   Amount:  '.
            html textInput
            on: #amount of: TransactionCreator.
                html break.

        html submitButton
            callback: [TransactionCreator createFromUI. self renderReport ];
            text: 'Create Transaction'.

    ].

2 个答案:

答案 0 :(得分:3)

你可以做几件事。

更容易渲染表格并将所有标签放入一列,文本输入另一列。您将使用css使表格和单元格边框不可见。

更好的解决方案是将css类分配给标签,然后再次使用css使所有标签具有相同的大小和方向。

答案 1 :(得分:0)

在CSS中肯定会这样做,这就是它的用途。您可以设置标签和输入元素以显示为块,然后使用宽度和对齐来获得所需的布局。

这样的事情应该让你开始:

form label {
  display: block;
  float: left;
  text-align: right;
  padding-right: 1em;
  padding-top: 0.3em;

  width: 15em;
}

form input {
  display: block;
  float: left;
  padding-top: 0.3em;
}

form br {
  clear: left;
}