加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

twitter-bootstrap – 在Twitter Bootstrap中排列标签和只读文本

发布时间:2020-12-17 23:59:16 所属栏目:安全 来源:网络整理
导读:我有一个与可编辑和只读字段混合的形式,我想使用Bootstrap风格。可编辑字段正确对齐,但只读字段不正确,如此屏幕截图所示: 我使用的HTML是: form class="form-horizontal"div class="control-group" label class="control-label"Name/label div class="c
我有一个与可编辑和只读字段混合的形式,我想使用Bootstrap风格。可编辑字段正确对齐,但只读字段不正确,如此屏幕截图所示:

我使用的HTML是:

<form class="form-horizontal">
<div class="control-group">
  <label class="control-label">Name</label>
  <div class="controls">
    John Smith
  </div>
</div>
<div class="control-group">
  <label class="control-label" for="date_of_birth">Date of Birth</label>
  <div class="controls">
    <input name="date_of_birth" id="date_of_birth" size="16" type="text" value="" />
    <span class="help-inline">dd/mm/yyyy</span>
  </div>
</div>
</form>

我不想为不能编辑的字段显示只读输入,因为用户在无法点击框时感到困惑/沮丧,这些字段是永远无法编辑的,因此它不会被编辑将它们显示为已禁用/只读是很有意义的。我只想让文本显示并与标签正确对齐。有没有办法,我可以做到这一点,通过使用Bootstrap中的东西或重写默认样式?

我的问题类似于this one,它没有回答(至少不是一个答案的原始问题),和Bootstrap已经在过去7个月多次发布,我认为这将是值得再次询问,如果任何变化。

解决方法

创建自己的风格并应用它如下 –
.controls.readonly
{
  padding-top: 5px;
}

<div class="control-group">
  <label class="control-label">Name</label>
  <div class="controls readonly">
    John Smith
  </div>
</div>

Bootstrap不包括每一个可能性,你需要制作自己的风格。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读