2015-06-05 222 views
4

我有點問題,但我解決不了,所以我有一個textarea,我想對準誰在裏面留下的文字,我的代碼是:對齊文本左

<textarea 
    rows="3" 
    cols="25" 
    id="{{ form_add_gift.description_article.name }}" 
    name="{{ form_add_gift.description_article.name }}" 
    style="padding: 0px !important; margin: 0px !important;text-align: left;" 
    class="form-control" 
    required="required"> 
    {{ form_add_gift.description_article.value|trim }} 
</textarea> 

的texarea外觀像這樣: 請幫助我! THX提前

enter image description here

+0

不工作......... 。 – TanGio

+0

加上空格:正常,不用再擔心空格了。檢查我的回答 – Prime

回答

3

這只是因爲你_______{{ form_add_gift.description_article.value|trim }}包含之初太多的空間。

只需刪除空格。

2

你給空間,同時文本顯示區提供輸入,無CSS改變需要囂的情況下可以嘗試:

<textarea 
    rows="3" 
    cols="25" 
    id="{{ form_add_gift.description_article.name }}" 
    name="{{ form_add_gift.description_article.name }}" 
    style="padding: 0px !important; margin: 0px !important;text-align: left;" 
    class="form-control" 
    required="required">{{ form_add_gift.description_article.value|trim }} 
</textarea> 
+0

@Gigel PLZ標記正確,如果它解決了問題 –

1

CONVERT

<textarea 
rows="3" 
cols="25" 
id="{{ form_add_gift.description_article.name }}" 
name="{{ form_add_gift.description_article.name }}" 
style="padding: 0px !important; margin: 0px !important;text-align: left;" 
class="form-control" 
required="required"> 
{{ form_add_gift.description_article.value|trim }} 
</textarea> 

TO

<textarea rows="3" cols="25" id="{{ form_add_gift.description_article.name  }}" name="{{ form_add_gift.description_article.name}}" style="padding: 0px  !important; margin: 0px !important;text-align: left;" class="form-control"  required="required">{{ form_add_gift.description_article.value|trim }</textarea> 

基本上是什麼你需要做的是標籤結束後刪除多餘的換行符和空格即

<textarea>your text</textarea> 
1

在textarea的刪除空格,或使用white-space: normal;作爲一個聰明的辦法,以避免textarea的空間。

刪除空格

<textarea 
    rows="3" 
    cols="25" 
    id="{{ form_add_gift.description_article.name }}" 
    name="{{ form_add_gift.description_article.name }}" 
    style="padding: 0px !important; margin: 0px !important;text-align: left;" 
    class="form-control" 
    required="required">{{ form_add_gift.description_article.value|trim }} 
</textarea> 

不能剝離的空間,加入空白:正常;

<textarea 
    rows="3" 
    cols="25" 
    id="{{ form_add_gift.description_article.name }}" 
    name="{{ form_add_gift.description_article.name }}" 
    style="padding: 0px !important; margin: 0px !important;text-align: left;white-space: normal;" 
    class="form-control" 
    required="required"> 
    {{ form_add_gift.description_article.value|trim }} 
</textarea> 
0

嘗試像下面的代碼<textarea>{{ form_add_gift.description_article.value|trim }}</textarea>之間取出的空間。

<textarea 
rows="3" 
cols="25" 
id="{{ form_add_gift.description_article.name }}" 
name="{{ form_add_gift.description_article.name }}" 
style="padding: 0px !important; margin: 0px !important;text-align: left;" 
class="form-control" 
required="required">{{ form_add_gift.description_article.value|trim }}</textarea> 
1

試試這個:

<textarea name="{{ form_add_gift.description_article.name }}" id="{{ form_add_gift.description_article.name }}" class="form-control" required="required" rows="3" cols="25" style="padding: 0px ; margin: 0px; align: left;" > 

     {{ form_add_gift.description_article.value|trim }} 
</textarea>  
1

從textarea的價值分配如刪除多餘的空格和換行:

<textarea>{{ form_add_gift.description_article.value|trim }}</textarea>