表单文本以填充空格开头

时间:2018-05-28 02:08:59

标签: html css twitter-bootstrap-3

我有这样的引导形式,
文本表单区域以填充开头:

我必须手动删除空格:

enter image description here

代码:

<form class="form-horizontal" action="/article/create/{{ b.id }}" method="POST">
        {% csrf_token %}
      <div class="form-group">
        <label for="title" class="col-sm-1 control-label">Title</label>
        <div class="col-sm-11">
          <input type="text" class="form-control" id="title" placeholder="
                Write Title Later" >
        </div>
      </div>
      <div class="form-group">
        <label for="content" class="col-sm-1 control-label" >Content</label>
        <div class="col-sm-11">
          <textarea class="form-control" id="content" rows="10" value="
                Write Content Firstly">
                </textarea>
        </div>
      </div>

      <div class="form-group">
        <div class="col-sm-offset-1 col-sm-11">
          <button type="submit" class="btn btn-primary">Publish</button>
        </div>
      </div>
    </form>

我的代码有什么问题?

1 个答案:

答案 0 :(得分:1)

您需要删除'textarea'和'/ textarea'之间的所有空格。这是更新的代码^^

<form class="form-horizontal" action="/article/create/{{ b.id }}" method="POST">
        {% csrf_token %}
      <div class="form-group">
        <label for="title" class="col-sm-1 control-label">Title</label>
        <div class="col-sm-11">
          <input type="text" class="form-control" id="title" placeholder="Write Title Later" />
        </div>
      </div>
      <div class="form-group">
        <label for="content" class="col-sm-1 control-label" >Content</label>
        <div class="col-sm-11">
          <textarea class="form-control" id="content" rows="10" value="
                Write Content Firstly"></textarea>
        </div>
      </div>

      <div class="form-group">
        <div class="col-sm-offset-1 col-sm-11">
          <button type="submit" class="btn btn-primary">Publish</button>
        </div>
      </div>
    </form>