Minimum width for <input> etc?

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

    Minimum width for <input> etc?

    How can i set in my css a min width for input elements, but leave the max
    size dynamic?

    Ben


  • Lauri Raittila

    #2
    Re: Minimum width for &lt;input&gt ; etc?

    In article <3f1ce1e5$0$236 01$5a62ac22@fre enews.iinet.net .au>, iinet
    wrote:[color=blue]
    > How can i set in my css a min width for input elements, but leave the max
    > size dynamic?[/color]

    for example:

    input {min-width:40em;}

    Won't work on IE. I don't think there is any way to make it work in IE.

    I don't think this is best possible answer to your question, URL would
    help.

    --
    Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
    Feel free to contact me by email if your message OT, or private, etc.
    but do not CC same message to as you send to usenet.

    Comment

    • Chris Morris

      #3
      Re: Minimum width for &lt;input&gt ; etc?

      Lauri Raittila <lauri@raittila .cjb.net> writes:[color=blue]
      > In article <3f1ce1e5$0$236 01$5a62ac22@fre enews.iinet.net .au>, iinet[color=green]
      > > How can i set in my css a min width for input elements, but leave the max
      > > size dynamic?[/color]
      >
      > for example:
      >
      > input {min-width:40em;}
      >
      > Won't work on IE. I don't think there is any way to make it work in IE.
      >
      > I don't think this is best possible answer to your question, URL would
      > help.[/color]

      According to the specification, min-width doesn't apply to
      non-replaced inline elements such as <input>, so you'd also need to do
      a display: block; or similar.

      And browsers tend to accept a lot less styling on form input elements
      than they do on others, so I'm not sure if this is reliably possible
      at all.

      Pity, because it could be quite useful for a user stylesheet. As
      regards author stylesheet it seems better to set the width
      appropriately through the HTML.

      --
      Chris

      Comment

      • Jukka K. Korpela

        #4
        Re: Minimum width for &lt;input&gt ; etc?

        Chris Morris <c.i.morris@dur ham.ac.uk> wrote:
        [color=blue]
        > According to the specification, min-width doesn't apply to
        > non-replaced inline elements such as <input>, so you'd also need to
        > do a display: block; or similar.[/color]

        The concepts of "replaced" or "non-replaced" element are confusingly
        and vaguely defined, but the CSS2 specification explicitly mentions
        INPUT as _replaced_ element. Well, in its vague style:
        "In HTML, IMG, INPUT, TEXTAREA, SELECT, and OBJECT elements can be
        examples of replaced elements."

        [color=blue]
        > And browsers tend to accept a lot less styling on form input
        > elements than they do on others,[/color]

        Indeed, but the situation is improving.
        [color=blue]
        > so I'm not sure if this is reliably possible at all.[/color]

        Surely not reliably - CSS is unreliable _by design_ (in the sense that
        a style sheet might not be applied, or might be applied in conjunction
        with other style sheets that override it, in part or entirely).
        [color=blue]
        > Pity, because it could be quite useful for a user stylesheet.[/color]

        Seems to work on Opera, for example. But there are other potential
        problems with input fields that might more serious. Authors often set
        font size in input fields to something very small, for example.

        --
        Yucca, http://www.cs.tut.fi/~jkorpela/

        Comment

        Working...