jQuery Mobile and textarea rows
Asked Answered
G

2

5

So, I'ld like to display a textarea on just 1 row.

But jQuery Mobile doesn't think so... Whatever value I set in the rows attribute, it always is 2 rows height...

Would it have any solution ?

Gabrielson answered 15/3, 2012 at 17:41 Comment(0)
R
11

The jQuery Mobile CSS sets a specific height for textarea elements:

textarea.ui-input-text {
    height : 50px;

    -webkit-transition : height 200ms linear;
       -moz-transition : height 200ms linear;
         -o-transition : height 200ms linear;
            transition : height 200ms linear;
}

You can create your own rule to override this height to something more single-line:

.ui-page .ui-content .ui-input-text {
    height : 25px;
}​

Demo: http://jsfiddle.net/mEs8U/

Residence answered 15/3, 2012 at 17:53 Comment(0)
T
1

You can also use max-height to set the autogrowing limits to textarea.

textarea.ui-input-text {
    max-height : 100px;
}
Thermic answered 20/8, 2014 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.