开发者

multiline html textarea

My form inherits several css styles, and the default display for a textarea only has a single row-- if you type a paragraph it won't wrap but conti开发者_Go百科nues going one the same line. How do I force it back to multi-row output? I have set the "rows" and "cols" attributes in the HTML but it doesn't seem to do anything.

The HTML is highly nested, but the actual input element is:

<input name="input47" type="textarea" rows="3" cols="10" />

The CSS I've tried is:

body form ol.sections li ol.prompts li ol.entries li ol.inputs li input[type=textarea] {
  height: 500px !important;
  white-space: normal !important;
}

The 500px works regardless whether or not I use !important, but there is only a single line of text in the textarea, vertically centered (Chrome and Safari).

EDIT: Clearly I need to brush up on my HTML-- <input type="textarea"> should have been <textarea>


You misuse <input /> element here. What you want to get is

<textarea name="input47" rows="3" cols="10">
        Your multiline text is here.
    </textarea>


I assume you have something like

white-space: nowrap;

applied to your textarea somewhere in your stylesheet and that's what makes it render the whole chunk of text in one line.

Just add something like

textarea#myfield {
    white-space: normal
}

There should be no need for !important in the style above, but if you don't get the result, you can try !important


please be aware that except of rows and cols you might also set height and width, which would affect it. It might be the case that you sets rows, but css property height overwrites it.


using UnityEngine; using System.Collections;

public class GameFSM : MonoBehaviour { public enum {LevelAwal, diam, terbang/lompat, objek, pertanyaan, bintang, menembak, menghindar, enemy, nyawa, GameOver, NextLevel}

public TurnStates state;
public bool gameInProgress = true;

void Start () {
    state = GameFSM.Mulai.Init;
    StartCoroutine ("TurnFSM");
}
private IEnumerator TurnFSM (){
    while(gameInProgress){
        switch(state){
        case TurnStates.LevelAwal:
            if( Permainan Awal()) {* state = diam:}
            break;
        case TurnStates.diam:
            if(Mulai()) {* state =lompat/terbang;}
            break;
        case TurnStates.Jump:
            if( Melompat()) {* state = objek;}
            break;
        case TurnStates.benda:
            if( mencari objek()) {* state = pertanyaan;}
            if (menghindar ()) {* state = enemy;}
            break;
        case TurnStates.objek:
            if( mencari Benda ()) {* state = pertanyaan;}
            if(Menembak()) {* state = enemy;}
            break;
        case TurnStates.enemy:
            if( Terkena Enemy ()) {* state = nyawa;}
            Break;
        case TurnStates.soal:
            if( benar ()) {* state = k;}
            else (salah ()) {* state = nyawa;}
            break;
        case TurnStates.nyawa:
            if(nyawa masih tersedia ()) {* state = diam;}
            else (nyawa masih habis ()) {* state = GameOver;}
            Break;
        case TurnStates.Kunci:
            if( berhasil menjawab()) {*state = NextGame;}
            break;
        case TurnState.NextGame :
            if (DoneLevel ()) {* state = LevelBaru;}
            break;
        }
        yield return null;
    } 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜