form examples in css2?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Franck

    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?
  • Janusz 'Kali' Kaliszczak

    #2
    Re: form examples in css2?

    Franck wrote:[color=blue]
    > 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?[/color]

    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/

    Comment

    • Unknown User

      #3
      Re: form examples in css2?

      On Thu, 27 Jan 2005 11:40:12 +0100, Franck <flc122NOSPAMPL EASE@free.fr>
      wrote:
      [color=blue]
      > 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?[/color]

      Salut Franck! VoilĂ :


      --
      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

      Comment

      • Steve Pugh

        #4
        Re: form examples in css2?

        Franck <flc122NOSPAMPL EASE@free.fr> wrote:
        [color=blue]
        >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?[/color]

        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 <steve@pugh.net > <http://steve.pugh.net/>

        Comment

        • boclair

          #5
          Re: form examples in css2?

          Steve Pugh wrote:

          [color=blue]
          > 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.[/color]

          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

          Comment

          • Franck

            #6
            Re: form examples in css2?

            [color=blue]
            > 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.[/color]

            thanks guys, I got it!

            Comment

            • Steve Pugh

              #7
              Re: form examples in css2?

              boclair <boclair@boclai r.com> wrote:[color=blue]
              >Steve Pugh wrote:
              >[color=green]
              >> 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.[/color]
              >
              >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?[/color]

              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.
              [color=blue]
              >"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".[/color]

              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.
              [color=blue]
              >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?[/color]

              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 <steve@pugh.net > <http://steve.pugh.net/>

              Comment

              • Jukka K. Korpela

                #8
                Re: form examples in css2?

                Steve Pugh <steve@pugh.net > wrote:
                [color=blue]
                > But why does the spec require it is a good question. I'm not sure I
                > have a complete answer.[/color]

                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.)
                [color=blue][color=green]
                >>"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".[/color]
                >
                > 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.[/color]

                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:
                A description of HTML 4's TEXTAREA element for multi-line text input.

                The specification

                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.
                [color=blue]
                > 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.[/color]

                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.
                [color=blue][color=green]
                >>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?[/color]
                >
                > 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.[/color]

                Technically, they are related to text line height and average character
                width.
                [color=blue]
                > 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.[/color]

                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.
                [color=blue]
                > In practical rather than theoretical terms you should start by
                > recalling that CSS is optional. Some browsers have very silly default
                > sizes for textareas - -[/color]

                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/

                Comment

                • Steve Pugh

                  #9
                  Re: form examples in css2?

                  "Jukka K. Korpela" <jkorpela@cs.tu t.fi> wrote:[color=blue]
                  >Steve Pugh <steve@pugh.net > wrote:
                  >[color=green]
                  >> But why does the spec require it is a good question. I'm not sure I
                  >> have a complete answer.[/color]
                  >
                  >Neither do I,[/color]

                  Oh good, that probably means I didn't miss anything obvious.
                  [color=blue]
                  >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.)[/color]

                  And, unlike in some other cases, HTML 2.0 doesn't provide a clearer
                  rationale over that (not) given in HTML 4.01 :-(
                  [color=blue][color=green][color=darkred]
                  >>>"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".[/color]
                  >>
                  >> 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.[/color]
                  >
                  >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[/color]

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

                  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 <steve@pugh.net > <http://steve.pugh.net/>

                  Comment

                  Working...