![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've always set form element sizes by using size on textfields and rows and cols on textareas. That's always lead to inconsistencies and a bit of guesswork when you want a form element to fill a fixed width and you want textfields to be as wide as textareas. Now, we can use a bit of CSS to set the width and for textareas also the height. Is that a good idea, and if so should I still set size, cols and rows? Is this widely supported? It seems like every few years I have to unlearn something. Jeff |
#3
| |||||
| |||||
|
|
I've always set form element sizes by using size on textfields and rows and cols on textareas. |
|
That's always lead to inconsistencies and a bit of guesswork when you want a form element to fill a fixed width and you want textfields to be as wide as textareas. |
|
Now, we can use a bit of CSS to set the width and for textareas also the height. |
|
Is that a good idea, and if so should I still set size, cols and rows? |
|
It seems like every few years I have to unlearn something. |
#4
| |||
| |||
|
|
Besides, the cols and rows attributes are required in a textarea element by HTML syntax. And you should always set the size attribute for a single-line text input field, since its default value is unspecified. |
#5
| |||
| |||
|
|
Gazing into my crystal ball I observed "Jukka K. Korpela" jkorp... (AT) cs (DOT) tut.fi> writing in news:csmrj.294458$GG1.83526 @reader1.news.saunalahti.fi: Besides, the cols and rows attributes are required in a textarea element by HTML syntax. And you should always set the size attribute for a single-line text input field, since its default value is unspecified. Before I posted my answer I was Googling for your thoughts on this, since you have replied to something like this before. Thank you. |
#6
| |||
| |||
|
|
Consider the CSS Caveats: http://www.cs.tut.fi/~jkorpela/css-caveats.html |
#7
| |||
| |||
|
|
Scripsit Jeff: I've always set form element sizes by using size on textfields and rows and cols on textareas. Fine. Just make sure you enlargen them to be sufficient. That's more than they currently are, probably. Too many textareas are stamp-size. Too few fields for surname input do not allow Mrs. Hämäläinen-Virrankoski to enter her name visibly. |
|
That's always lead to inconsistencies and a bit of guesswork when you want a form element to fill a fixed width and you want textfields to be as wide as textareas. Then stop wanting such things. The widths are for convenient input, not for the author's esthetic eye. Now, we can use a bit of CSS to set the width and for textareas also the height. That doesn't mean we should. Is that a good idea, and if so should I still set size, cols and rows? Consider the CSS Caveats: http://www.cs.tut.fi/~jkorpela/css-caveats.html Besides, the cols and rows attributes are required in a textarea element by HTML syntax. And you should always set the size attribute for a single-line text input field, since its default value is unspecified. It seems like every few years I have to unlearn something. Indeed. But that's a different story. |
#8
| |||||
| |||||
|
|
Too few fields for surname input do not allow Mrs. Hämäläinen-Virrankoski to enter her name visibly. Oddly, my default text field is 30, which is more than that. |
|
And I usually make textareas 55 x 4 sometimes with an auto lengthen. |
|
The trouble is that you usually want textareas to take up the max width |
|
and generally you have to downsize them to due to width requirements on some browser. |
|
That's why I thought style="width: 100%" would be nice. |
#9
| |||
| |||
|
|
On 2008-02-09, Jukka K. Korpela <jkorpela (AT) cs (DOT) tut.fi> wrote: [...] Consider the CSS Caveats: http://www.cs.tut.fi/~jkorpela/css-caveats.html One thing you say there is "CSS Support varies [...] For form fields, many CSS properties are often ignored by browsers". It's not really lack of "support" for anything. |
|
As far as the CSS 2.1 specification is concerned, buttons, textareas, etc., are replaced elements. You shouldn't expect to be able to style them with CSS properties at all, although most browsers do let you set a few things. |
#10
| |||||||
| |||||||
|
|
Scripsit Jeff: Too few fields for surname input do not allow Mrs. Hämäläinen-Virrankoski to enter her name visibly. Oddly, my default text field is 30, which is more than that. Your 30 is a reasonable value. I wrote "too few". And I usually make textareas 55 x 4 sometimes with an auto lengthen. Auto lengthen? |
|
Anyway, 4 is far from sufficient for any normal textarea. |
|
like to use a word processor with a document canvas of that size? It's frustrating to see less than a paragraph of what you have written so far. Such a size is a message about the value assigned to user input by the form designer and about the amount of text expected. That is, it says: don't bother sending us anything that matters much. The trouble is that you usually want textareas to take up the max width Do I? I don't think that a screen-wide textarea is convenient, and it surely looks odd on most screens. A width of 55 characters or so (maybe somewhat more) is generally suitable. The problem with it is that it forces horizontal scrolling in a narrows window. But I don't think it's a very serious problem. |
|
and generally you have to downsize them to due to width requirements on some browser. Pardon? |
|
That's why I thought style="width: 100%" would be nice. Not really as nice as one might expect. Even if you set font-size: 100% and something like font-family: Cambria, Georgia, serif (making typing reasonably convenient), a textarea with size="55" fits into half of the width of a fairly normal screen. This should be acceptable, and anything wider probably doesn't significantly improve the ease of writing. |
|
It would be more relevant to make the _height_ as large as possible (on CSS-enabled browsers), but there's no simple way to do that. |
![]() |
| Thread Tools | |
| Display Modes | |
| |