【问题标题】:How to fit a placeholder in the form?如何在表单中放置占位符?
【发布时间】:2019-01-26 19:20:09
【问题描述】:

我正在处理fiddle 中所示的表单,我想在表单中放置一个完整的占位符文本。

我用来制作小型输入表单的 HTML 是:

<div class="container text-center ">
   <div class="form-group">
      <label class="ml-2" style="width:100%;text-align:left;" for="inputAddress">Hello World</label>
      <input type="text" class="form-control" id="inputAddress" placeholder="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.">
   </div>
</div>


问题陈述:

我想知道我应该在小提琴中进行哪些更改,以便我可以看到完整的占位符文本。此时,我可以看到几个字(不是完整的陈述),如下图所示:


【问题讨论】:

标签: html css forms bootstrap-4 placeholder


【解决方案1】:

使用 textarea 代替 input,这将为您提供多行显示。

看这个例子:https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_placeholder

【讨论】:

    【解决方案2】:

    您应该尝试使用textarea 而不是input

    【讨论】:

      【解决方案3】:

      这不是 Bootstrap 问题,但您可以像这样使用 CSS3 -placeholder...

      http://jsfiddle.net/navcLefq/1/

      ::-webkit-input-placeholder {
        white-space:pre-line;  
        position:relative;
      }
      ::-moz-placeholder {
        white-space:pre-line;  
        position:relative;
      
      }
      :-ms-input-placeholder {
        white-space:pre-line;  
        position:relative;
      }
      :-moz-placeholder {
        white-space:pre-line;  
        position:relative;
      }
      

      【讨论】:

      • 在 FF 中,所有东西仍然站在一行上,这是不可读的,无论如何输入都应该变成 textarea ;)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-04
      • 2014-04-11
      • 2012-04-07
      • 1970-01-01
      • 1970-01-01
      • 2022-06-25
      相关资源
      最近更新 更多