text and password input size differences

Discussion in 'CSS' started by grobar, May 17, 2007.

  1. #1
    I have two inputs, one for text (username) and one of type="password." both have a specified size of "40" for the width.

    In the older IE, the PW field appears to be about 10 pixels shorter...is there any way to correct this? They show up properly in FF and the New IE
     
    grobar, May 17, 2007 IP
  2. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #2
    How about posting a... link?
    Are you using the size attribute or the width css property?
     
    soulscratch, May 17, 2007 IP
  3. Mr D

    Mr D Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you should use css for this: input{ widht: 50px;}
     
    Mr D, May 17, 2007 IP
  4. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #4
    No, he shouldn't use that because that will style ALL inputs as 50 pixels... maybe there are more fields and that would cause them to also get this width. This would be fine if there are no more inputs. Assuming your code is like so:

    <label for="username">Username:</label>
    <input type="text" id="username" name="username" />

    <label for="password">Password:</label>
    <input type="password" id="password" name="password" />

    you can do:
    input#password, input#username { width:40px; }

    or just #password, #username { width:40px; } , but the reason I use the element name is because I work with TONS of sites, and in X number of months if I look back at the style sheet and see just an ID, I wouldn't know exactly what it is, but if it has the element name next to it, it makes it much easier.
     
    soulscratch, May 17, 2007 IP
  5. solution2u

    solution2u Peon

    Messages:
    252
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Agree. Using class or id is a better option
     
    solution2u, May 18, 2007 IP