【问题标题】:How to align two input texts on a line in Materialize?如何在 Materialise 中对齐一行上的两个输入文本?
【发布时间】:2018-11-20 03:30:26
【问题描述】:

我想在 Materialize.css 上将两个输入文本居中,但是当我尝试这样做时结果并不好。代码如下:

<div class="card-content valign center">
    <div class="row">
        <form class="col s12">
            <div class="row">
                <div class="input-field col s3">
                    <input id="Valor1" type="text" class="validate" maxlength="10">
                    <label for="Valor1">Valor 1</label>
                </div>
                <div class="input-field col s3">
                    <input id="Valor2" type="text" class="validate" maxlength="10">
                    <label for="Valor2">Valor 2</label>
                </div>
            </div>
        </form>
    </div>
</div>

这里有很多文本字段例如:Materalize Text Fields

【问题讨论】:

  • 当你说结果不好时,你到底看到了什么?
  • 两个输入文本停留在左侧。

标签: html css material-design materialize


【解决方案1】:

为了使输入居中,您可以将offsets 添加到您的第一列:

<div class="input-field col s3 offset-s3">
    <input id="Valor1" type="text" class="validate" maxlength="10">
    <label for="Valor1">Valor 1</label>
</div>

您的行的总长度为 12 列。您的两个输入共有 6 列。通过左侧 3 列的偏移量,您可以获得所需的元素居中。

【讨论】:

  • 非常感谢 ikkuh。正是我正在寻找的。​​span>
猜你喜欢
  • 1970-01-01
  • 2014-11-29
  • 2022-12-03
  • 1970-01-01
  • 2018-07-28
  • 1970-01-01
  • 2020-07-18
  • 1970-01-01
  • 2018-06-24
相关资源
最近更新 更多