473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

form examples in css2?

Hi,

I'm having problems with css2/xhtml based form. I didn't find examples
to see what can be done, especially textarea. How to define cols="45"
rows="4" in css?
Jul 21 '05 #1
8 4092
Franck wrote:
Hi,

I'm having problems with css2/xhtml based form. I didn't find examples
to see what can be done, especially textarea. How to define cols="45"
rows="4" in css?


You can't define.
Number of columns and rows is part of functionality definition of form
elements, not a layout definition.

--
Janusz 'Kali' Kaliszczak
=> http://janusz.kaliszczak.pl/
Jul 21 '05 #2
On Thu, 27 Jan 2005 11:40:12 +0100, Franck <fl****************@free.fr>
wrote:
Hi,

I'm having problems with css2/xhtml based form. I didn't find examples
to see what can be done, especially textarea. How to define cols="45"
rows="4" in css?


Salut Franck! Voilà:
http://www.quirksmode.org/css/forms.html

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Discover Opera: http://members.surfeu.fi/jerkku/
http://www.auriance.com - http://www.auriance.net
Jul 21 '05 #3
Franck <fl****************@free.fr> wrote:
I'm having problems with css2/xhtml based form. I didn't find examples
to see what can be done, especially textarea. How to define cols="45"
rows="4" in css?


You can set the width and height for the textarea just the same as for
any other element. But you must still include the cols and rows in the
HTML as those attributes are required by the HTML specification.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 21 '05 #4
Steve Pugh wrote:

You can set the width and height for the textarea just the same as for
any other element. But you must still include the cols and rows in the
HTML as those attributes are required by the HTML specification.


This is a genuine query.

Why "must" one include the cols and rows attributes if height and width
are declared by a css rule set. Is it just to satisfy the validator?

"The required ROWS and COLS attributes specify the number of visible
rows and columns, respectively, in a visual browser. These attributes
provide a <<guide>> for the user rather than a restriction; browsers
allow an unlimited amount of text input in theory, though in practice
many browsers limit the contents of a TEXTAREA to 32 or 64 kilobytes".

The css properties WIDTH and ROW seem to provide the same <<guide>> and
moreover seem to over ride the HTML attributes. Do I miss something?

Louise
Jul 21 '05 #5
You can set the width and height for the textarea just the same as for
any other element. But you must still include the cols and rows in the
HTML as those attributes are required by the HTML specification.


thanks guys, I got it!
Jul 21 '05 #6
boclair <bo*****@boclair.com> wrote:
Steve Pugh wrote:
You can set the width and height for the textarea just the same as for
any other element. But you must still include the cols and rows in the
HTML as those attributes are required by the HTML specification.
This is a genuine query.

Why "must" one include the cols and rows attributes if height and width
are declared by a css rule set. Is it just to satisfy the validator?


It's not just the satisfy the validator - the validator requires it
because the spec requires it. Not the other way round.

But why does the spec require it is a good question. I'm not sure I
have a complete answer.
"The required ROWS and COLS attributes specify the number of visible
rows and columns, respectively, in a visual browser. These attributes
provide a <<guide>> for the user rather than a restriction; browsers
allow an unlimited amount of text input in theory, though in practice
many browsers limit the contents of a TEXTAREA to 32 or 64 kilobytes".
It's interesting that the mention of them being a 'guide' is in the
same sentence as the mention of a limit on the size of the data
accepted. A smart author can pick col and row values that give users a
guide as to how much data is expected from them. As such it would not
be unreasonable for non-visual user agents to indicate this 'size' in
some way.
The css properties WIDTH and ROW seem to provide the same <<guide>> and
moreover seem to over ride the HTML attributes. Do I miss something?


The row and col values are (loosely) tied to the size of a character
and thus fit well with the "expected amount of data" idea. The CSS
length units can be (loosely) tied to the size of a character (em and
ex) or totally divorced from it (px, mm, %, etc.) so the two are not
interchangable.

In practical rather than theoretical terms you should start by
recalling that CSS is optional. Some browsers have very silly default
sizes for textareas and specifying a sensible fallback for when CSS is
not enabled (or is being ignored, e.g. Opera has an option to disable
styling of just form elements) is smart.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 21 '05 #7
Steve Pugh <st***@pugh.net> wrote:
But why does the spec require it is a good question. I'm not sure I
have a complete answer.
Neither do I, especially since the HTML spec does not require a SIZE
attribute in <input> elements but implies some browser-specific default
(though the situation is different, since not all <input> elements are text
input fields). My answer is that there is no good answer. Someone just
decided that ROWS and COLS are required, instead of deciding that browsers
are expected to use some defaults. (They were required even in HTML 2.0.)
"The required ROWS and COLS attributes specify the number of visible
rows and columns, respectively, in a visual browser. These attributes
provide a <<guide>> for the user rather than a restriction; browsers
allow an unlimited amount of text input in theory, though in practice
many browsers limit the contents of a TEXTAREA to 32 or 64 kilobytes".


It's interesting that the mention of them being a 'guide' is in the
same sentence as the mention of a limit on the size of the data
accepted.


The text was quoted without specifying the source. It is apparently from
the WDG HTML 4.0 reference, which is excellent, but not a specification:
http://www.htmlhelp.com/reference/ht.../textarea.html
The specification
http://www.w3.org/TR/html4/interact/...#edef-TEXTAREA
defines ROWS as specifying the number of rows and COLS as specifying "the
visible width in average character widths". So they are specific
instructions to browsers rather than a guide. Quite independently of this,
browsers are expected to allow unlimited input, i.e. the numbers are not
limits upon amount of data but dimensions of physical input area.
A smart author can pick col and row values that give users a
guide as to how much data is expected from them. As such it would not
be unreasonable for non-visual user agents to indicate this 'size' in
some way.
Or maybe it would. In practice at least. It is horrendously common to
specify ridiculously small ROWS and COLS attributes. I guess the resulting
stamp size honestly reflects the value assigned to user input by the form
designer. But I still would not suggest that non-visual user agents tell
some guesses based on those values. After all, if the user input has some
maximum or recommended size, then it's the form designer's job to tell them
in the textual content before the field.
The css properties WIDTH and ROW seem to provide the same <<guide>> and
moreover seem to over ride the HTML attributes. Do I miss something?


The row and col values are (loosely) tied to the size of a character
and thus fit well with the "expected amount of data" idea.


Technically, they are related to text line height and average character
width.
The CSS
length units can be (loosely) tied to the size of a character (em and
ex) or totally divorced from it (px, mm, %, etc.) so the two are not
interchangable.
In practice, ROWS and COLS are often the _best_ way to specify the
dimension. They have no direct CSS counterpart. But if you explicitly set
line-height, then ROWS="n" should be equivalent to height: n2, where n2 is
n multiplied by the line-height value. But this is not very relevant, since
the ROWS attribute is required. For COLS, there is really no CSS
equivalent; there is no concept like "average character width" in CSS.
As a rough rule of thumb, em corresponds to two times the average character
width and ex corresponds to the average character width. But this is just
the average over fonts. In most fonts, it's either bigger or smaller.
In practical rather than theoretical terms you should start by
recalling that CSS is optional. Some browsers have very silly default
sizes for textareas - -


Or they may have no defaults. A textarea without those attributes is a
syntax error, and browsers may do whatever they like, e.g. not render the
textarea at all.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 21 '05 #8
"Jukka K. Korpela" <jk******@cs.tut.fi> wrote:
Steve Pugh <st***@pugh.net> wrote:
But why does the spec require it is a good question. I'm not sure I
have a complete answer.
Neither do I,


Oh good, that probably means I didn't miss anything obvious.
My answer is that there is no good answer. Someone just
decided that ROWS and COLS are required, instead of deciding that browsers
are expected to use some defaults. (They were required even in HTML 2.0.)
And, unlike in some other cases, HTML 2.0 doesn't provide a clearer
rationale over that (not) given in HTML 4.01 :-(
"The required ROWS and COLS attributes specify the number of visible
rows and columns, respectively, in a visual browser. These attributes
provide a <<guide>> for the user rather than a restriction; browsers
allow an unlimited amount of text input in theory, though in practice
many browsers limit the contents of a TEXTAREA to 32 or 64 kilobytes".


It's interesting that the mention of them being a 'guide' is in the
same sentence as the mention of a limit on the size of the data
accepted.


The text was quoted without specifying the source. It is apparently from
the WDG HTML 4.0 reference, which is excellent, but not a specification:
http://www.htmlhelp.com/reference/ht.../textarea.html


Oh, well, in that case my little thought experiment is a bit of a
waste of time. Never mind.
browsers are expected to allow unlimited input, i.e. the numbers are not
limits upon amount of data but dimensions of physical input area.


Oh yes. I never meant to imply otherwise.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Bob Smith | last post by:
Hi all I have a page which contains a form. I want a customized button with an image for the submit button, and when the submit button has been clicked send the form to the perl script. Now the...
4
by: Neil Zanella | last post by:
Hello, I would like to know what the major enhancements of CSS2 over CSS1 are and whether CSS2 support is any better these days than it was a few years ago. In particular, do most browsers fully...
12
by: Michael Winter | last post by:
Is it possible to test for CSS level 2 support, preferably using just CSS2? For example, the following could alert the user that their browser doesn't support CSS1 or 2. Is there an equivalent for...
6
by: Patrick | last post by:
Hi I am a newbie struggling a little with css.It is hard to get it right in all browsers, so i decided to read the CSS2 specification on the w3 site. What is the following from the CSS2...
20
by: Karl Smith | last post by:
I heard a rumour that Opera succeeded where none have before, and implemented the tables described in HTML4 and CSS2. So I thought I'd try it out with the well known Periodic Table. ...
14
by: Michael Bulatovich | last post by:
Has anyone got a good link to a concise discussion of where things now stand regarding these two? e.g. What browsers are compliant with one or the other? What the adoption rate is of these...
2
by: Jan Roland Eriksson | last post by:
The following URL... <http://www.w3.org/TR/CSS21/> ....has had the following text in it for a considerable time now. "This is a W3C Candidate Recommendation, which means the specification...
2
by: Xah Lee | last post by:
what's new in CSS2? http://xahlee.org/js/css2.html Xah xah@xahlee.org ∑ http://xahlee.org/
2
by: David E. Ross | last post by:
A new working draft of the CSS2.1 specification was published on-line on 11 April. Does anyone know what changed since the previous (13 June 2005) working draft? -- David E. Ross...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.