小编Thy*_*sus的帖子

Bootstrap形式 - 没有标签文本的复选框的水平垂直对齐

我今天早上已经从Bootstrap 3.0.0更改为3.2.0,因为我需要为我的Web应用程序提供一些新功能.在我观察到.form-horizontal表单中复选框的垂直对齐问题之前,所有内容似乎都按预期工作.

有关示例,请访问http://www.bootply.com/AYN64feYze.这个最小例子的标记是:

<div class="form-horizontal">
    <div class="form-group">
      <label class="col-sm-2 control-label">With label text</label>
          <div class="col-sm-10">
            <div class="checkbox">
              <label>
                  <input type="checkbox"> label text
              </label>
            </div>
          </div>
    </div>
  <div class="form-group">
      <label class="col-sm-2 control-label">Without label text</label>
          <div class="col-sm-10">
            <div class="checkbox">
              <label>
                  <input type="checkbox">
              </label>
            </div>
          </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

如果复选框没有后续文本,则它会移动到它应该出现的行的下方.

有这个问题的解决方案吗?由于我已经拥有领先的标签,因此我的复选框不需要以下文字.我目前的解决方法是在<label>包含的文本中添加文本,<input type="checkbox">并使用背景颜色作为字体颜色来隐藏文本.

谢谢您的帮助.

html css checkbox vertical-alignment twitter-bootstrap

8
推荐指数
1
解决办法
4万
查看次数

带有转义引号的 Groovy JsonSlurper JSON 值

我正在开发一个用 Groovy 编写的小工具,用于解析电子邮件中的 JSON 字符串。其中一些 JSON 字符串具有包含转义引号的 JSON 值。

例如:

{
   "hello": "world with \"quotation marks\""
}
Run Code Online (Sandbox Code Playgroud)

为了解析这些字符串,我使用了 Groovy 的 JsonSlurper。以下代码演示了我的问题:

import groovy.json.JsonException
import groovy.json.JsonSlurper

try {     
  print new JsonSlurper().parseText('''
    {
      "hello": "world with \"quotation marks\""
    }
  ''')
} catch (JsonException | IllegalArgumentException e) {
  print e
}
Run Code Online (Sandbox Code Playgroud)

有关实时演示,请参阅https://groovyconsole.appspot.com/script/6193189027315712

执行此代码时,抛出以下异常:

groovy.json.JsonException: expecting '}' or ',' but got current char 'q' with an int value of 113

The current character read is 'q' with an int value of 113 …
Run Code Online (Sandbox Code Playgroud)

string groovy json escaping jsonslurper

4
推荐指数
1
解决办法
5223
查看次数