Select on input type

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

    Select on input type

    Is it possible to craft a selector that selects on input type?

    It would be useful to be able to distinguish between type="text" and
    type="checkbox" .

  • Johannes Koch

    #2
    Re: Select on input type

    Hans Malherbe schrieb:
    Is it possible to craft a selector that selects on input type?
    >
    It would be useful to be able to distinguish between type="text" and
    type="checkbox" .
    Look up the various attribute selectors in CSS 2.x.
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)

    Comment

    • Jukka K. Korpela

      #3
      Re: Select on input type

      Scripsit Johannes Koch:
      Hans Malherbe schrieb:
      >Is it possible to craft a selector that selects on input type?
      >>
      >It would be useful to be able to distinguish between type="text" and
      >type="checkbox ".
      >
      Look up the various attribute selectors in CSS 2.x.
      And beware of the Drag... I mean Internet Explorer 6 and older. IE 6 is
      still the most commonly used browser, and it does not understand attribute
      selectors. (Also note that CSS 2.1 is a draft that says that it may change
      at any moment with no warning, and CSS 2.0 as such has in effect been
      rejected both by the W3C and browser vendors, and there is no other CSS 2.x.
      Good luck. :-( )

      The practical solution, thus, as mentioned about monthly in this group, is
      to use a clumsier approach that uses selectors that even IE 6 understands.
      Class selectors are the simple way, but often you don't need to add a class
      attribute into _each_ <inputelement . For example, if you group checkboxes
      into fieldsets so that they only appear inside <fieldsetelemen ts that
      contain no other input elements, you can use e.g.
      <fieldset class="checkbox es"...
      and the selector
      .checkboxes input

      Or if your form has 42 input fields, 41 of them with type="text" (expressed
      or implied) and one with type="submit" and you want to make the font in text
      input fields monospace (great idea - simple, but few people have found it),
      you can use just <input type="submit" class="submit" ...and

      input { font-family: Consolas, Courier New, monospace; }
      input.submit { font-family: sans-serif; }

      That is, you set the property for the element in general, then override it
      for those cases where you don't want it.

      --
      Jukka K. Korpela ("Yucca")


      Comment

      • Bergamot

        #4
        Re: Select on input type

        Jukka K. Korpela wrote:
        >
        Also note that CSS 2.1 is a draft that says that it may change
        at any moment with no warning
        You often mention this, but realistically what are the chances that it
        *will* change? Pretty close to zero, don't you think?

        --
        Berg

        Comment

        • Joshua Cranmer

          #5
          Re: Select on input type

          Bergamot wrote:
          Jukka K. Korpela wrote:
          >Also note that CSS 2.1 is a draft that says that it may change
          >at any moment with no warning
          >
          You often mention this, but realistically what are the chances that it
          *will* change? Pretty close to zero, don't you think?
          >
          From the CSS working group's own words (7/20/07):
          The CSS WG published the new Candidate Recommendation (CR) for CSS level
          2 revision 1, with the firm intention that there won't be any more
          working drafts.

          From CSS 2.1 CR draft:
          Features at Risk:
          New 'list-style-type' values:
          'armenian'
          'georgian'
          'lower-greek'
          Multiple ID attributes for ID selector
          Automatic table layout algorithm
          Quotes
          BODY element in XHTML (transfer special case in HTML to XHTML)

          I'd give the chance of the relevant part of the draft -- attribute in
          CSS selector, which is actually CSS 2, of being changed somewhere
          between the inverse Ackermann function of one over Grahm's number and zero.

          --
          Beware of bugs in the above code; I have only proved it correct, not
          tried it. -- Donald E. Knuth

          Comment

          • Jukka K. Korpela

            #6
            Re: Select on input type

            Scripsit Bergamot:
            Jukka K. Korpela wrote:
            >>
            >Also note that CSS 2.1 is a draft that says that it may change
            >at any moment with no warning
            >
            You often mention this, but realistically what are the chances that it
            *will* change? Pretty close to zero, don't you think?
            It depends. Is 0.42 close to zero?

            The CSS 2.1 drafts have a sad history of slow progress and odd changes, and
            there was already a move back (downwards) in the "standardizatio n" path.

            --
            Jukka K. Korpela ("Yucca")


            Comment

            Working...