SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot Arkkimaagi's Avatar
    Join Date
    Mar 2002
    Location
    Lappeenranta, Finland
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to refer to "input type=text" fields?

    I'd like to change the font, background and borders from all my input fields that are either text or textarea type.

    If I try to use INPUT {color:blue; etc..} It alters also the radiobuttons etc, and it looks ugly.

    I could add an class to the certain types, but because this is an messageboard application and it does not yet have those coded in, it would make updating the aplication hard.

    So basicly I need to refer to standard form elements with css, and I want to limit it to certain types (text and textarea).

    Can this be done?

  2. #2
    SitePoint Zealot Hulkur's Avatar
    Join Date
    Oct 2001
    Location
    Estonia
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CSS2

    E[foo="warning"]
    Matches any E element whose "foo" attribute value is exactly equal to "warning".

    i.e. input[type="text"] { }

    from : http://www.w3.org/TR/REC-CSS2/selector.html
    (2B) or (not 2B) = FF

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only problem with using CSS2 is that is that no browsers support it.

    You could try giving each input type it's own id

    #textI {your text input style}
    #buttonI {your button style}
    etc.

    <input type="text" name="a" id="textI" value="">
    <input type="text" name="b" id="textI" value="">
    <input type="button" name="go" id="buttonI" value="GO">

    Also, check this out http://www.pxl8.com/styling_inputs.html

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always rename the checkboxes and radio buttons to different classes. that way you can say:
    Code:
    input.class { background-color: #666666; }
    HTH.
    Sketch
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Zealot Arkkimaagi's Avatar
    Join Date
    Mar 2002
    Location
    Lappeenranta, Finland
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sketch I know, but I specially am asking for an css only solution because the application I need to use, has hundreds of textboxes, written with asp/html and its loads of work to add those class things. Not to mention the fact that in case of an update, I need to do all that work all over again.

  6. #6
    SitePoint Zealot Hulkur's Avatar
    Join Date
    Oct 2001
    Location
    Estonia
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only problem with using CSS2 is that is that no browsers support it.
    Update yourself

    Opera 6.04 supports (all 6.x AFAIK),
    Mozilla 1.0 supports
    IE 6 in some way
    (2B) or (not 2B) = FF

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    input[type="text"] { }

    Those browsers support this?

  8. #8
    SitePoint Zealot Hulkur's Avatar
    Join Date
    Oct 2001
    Location
    Estonia
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    about this:
    Mozilla 1.0 supports
    Opera 6.04 doesn't
    haven't tested on IE

    CSS2 support is mostly partial on browsers
    (2B) or (not 2B) = FF

  9. #9
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Hulkur.

  10. #10
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    getElementsByTagName and iteration for attributes no help here?!

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  11. #11
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .oO( obviously NOT - you fool! )

    Sorry about that - i was being silly!

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •