SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2002
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    style that only affects input type="text" ?

    hey, i can get this to work on mozilla, how can i get this to work so that only input types that ="text" use this style?

    PHP Code:
    body #container #staffLogin form input[type=text] {
         /*mozilla, safari*/
             
    background-color:#FFFFFF;
             
    border:1px solid #00A6DC;
             
    width:100px;
         } 

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    input[type="text"] will work in every browser except Internet Explorer (both Win and Mac). If you want the same effects everywhere you have to give each textbox the same class name.
    Code:
    .tbox {
      color: blue;
      background: yellow;
      width: 200px;
    }
    HTML Code:
    <input type="text" name="mytext" class="tbox" />

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2002
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    shucks. that's too bad. good information to remember. one more reason to not use IE.

  4. #4
    SitePoint Addict Tim_Rogovets's Avatar
    Join Date
    Aug 2003
    Location
    Odessa, Ukraine
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm. Nice thread. I've faced the same problem before, but was forced to type in class='whatever' into every input field I needed.

    Does the tag[attribute="value"] technique work with all tags?
    Can I use it like this? :
    Code:
    table[width="100"] {
    blah blah blah
    }
    CEO of Grandiz! - a team based in Odessa, Ukraine.
    Designing and developing sophisticated web apps on CodeIgniter!

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Does the tag[attribute="value"] technique work with all tags?
    Can I use it like this? :

    Code:
    table[width="100"] {blah blah blah}

    Yes that will work in mozilla etc. AFAIK any attribute can be targetted

    Paul

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Tim_Rogovets
    Hmm. Nice thread. I've faced the same problem before, but was forced to type in class='whatever' into every input field I needed.

    Does the tag[attribute="value"] technique work with all tags?
    Can I use it like this? :
    Code:
    table[width="100"] {
    blah blah blah
    }
    Yep, you can also use tag[attribute] (without the value) if you just want to find any tag that has that particular attribute. For example, this is a nifty one if you debug a lot with Mozilla or Opera. If an image doesn't have an alt it will still appear; if it does have an alt, it will not display:
    Code:
    img[alt] {
      display: none;
    }
    Then you can go in and add the necessary alt attributes for the images you missed .

  7. #7
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Off Topic:


    Vinnie is that you in your avatar

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Paul O'B
    Off Topic:


    Vinnie is that you in your avatar
    Off Topic:

    That's what it feels like today at least

  9. #9
    SitePoint Addict Tim_Rogovets's Avatar
    Join Date
    Aug 2003
    Location
    Odessa, Ukraine
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for clearing this out guys.
    Really useful CSS feature I didn't know.
    CEO of Grandiz! - a team based in Odessa, Ukraine.
    Designing and developing sophisticated web apps on CodeIgniter!

  10. #10
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    Sydney, Australia
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DAMM M$. I saw this thread in hope, only to find IE doesnt support this. Errr!!!! Im in the process of fixing up some forms someone made and there is heaps of input tags. Scheiße!!!!

    Damm MS chain smoking hippies!

    now i have to make a search/replace regexp to fix this bloody problem.

  11. #11
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Bling
    DAMM M$. I saw this thread in hope, only to find IE doesnt support this. Errr!!!! Im in the process of fixing up some forms someone made and there is heaps of input tags. Scheiße!!!!

    Damm MS chain smoking hippies!

    now i have to make a search/replace regexp to fix this bloody problem.
    Calm down man, it's not that bad. Yeah IE could use a little help in the CSS department, but it's not the end of the world.


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
  •