复选框采用水平形式,位于标签的右侧

时间:2016-08-23 06:25:35

标签: ruby-on-rails simple-form

左边的复选框标签是否可以像其他标签一样,右侧的复选框与其他带水平格式的输入一样?

我当前的设置

enter image description here

看起来非常糟糕。

编辑:

    CGraphicScene *scene;
    CContextualMenu *m_contextualMenu;
    m_contextualMenu = new CContextualMenu(this);
    m_contextualMenu ->close();
    scene = new CGraphicScene(m_contextualMenu);

    ui->gvInterface -> setScene(scene);
    connect(scene, SIGNAL(signalChangeContextualMenuPosition()), this, SLOT(openPopUp()));

    void MainWindow :: openPopUp()
    {
         m_contextualMenu ->move(m_xCoordPopMenu, m_yCoordPopMenu);
    }

    void MainWindow :: mousePressEvent(QMouseEvent *event)
    {
        if(event -> button() == Qt::RightButton)
        {
            m_xCoordPopMenu = event -> x();
            m_yCoordPopMenu = event -> y();
        }
    }

在视图中生成以下html:

<form action="" method="POST">
  <input type="text" name="bill_no" placeholder="Bill no" />
  <input type="text" name="patient_name" placeholder="Patient name" />
  <input type="date" name="bill_date">
  <input type="submit" name="submit" value="Submit">
</form>

1 个答案:

答案 0 :(得分:1)

您可以将pull-right添加到复选框元素的类中,如下所示:

<input name="uh" id="uhhuh" type="checkbox" class="pull-right" />

使用用户提供的代码更新了答案:

  <div class="form-group boolean optional apartment_pets">
    <div class="checkbox"><input value="0" type="hidden" name="apartment[pets]">
      <label class="boolean optional" for="apartment_pets">Husdyr tilladt</label>
        <input class="boolean optional" type="checkbox" value="1" name="apartment[pets]" id="apartment_pets" class="pull-right">        
    </div>
  </div>

我从未使用simple_form,但是在浏览文档时,您应该使用:label => false:inline_label => true的组合来定位标签。